@@ -18,11 +18,6 @@ inputs:
1818runs :
1919 using : " composite"
2020 steps :
21- - name : Install devbox
22- shell : bash
23- run : |
24- curl -fsSL https://get.jetpack.io/devbox | FORCE=1 bash
25-
2621 - name : Workaround for permission issue
2722 if : inputs.enable-cache == 'true'
2823 shell : bash
@@ -39,24 +34,51 @@ runs:
3934 /nix/var/nix
4035 key : ${{ runner.os }}-devbox-${{ hashFiles(format('{0}/devbox.json', inputs.project-path)) }}
4136
42- - name : devbox version
43- id : devbox-version
44- if : inputs.devbox-version == ''
45- uses : pozetroninc/github-action-get-latest-release@v0.5.0
37+ - name : Get devbox version
38+ shell : bash
39+ env :
40+ DEVBOX_USE_VERSION : ${{ inputs.devbox-version }}
41+ run : |
42+ if [[ -n $DEVBOX_USE_VERSION ]]; then
43+ echo "latest_version=$DEVBOX_USE_VERSION" >> $GITHUB_ENV
44+ else
45+ tmp_file=$(mktemp)
46+ latest_url="https://releases.jetpack.io/devbox/latest/version"
47+ curl --fail --silent --location --output "${tmp_file}" "${latest_url}"
48+ latest_version=$(cat "${tmp_file}")
49+ if [[ -n ${latest_version} ]]; then
50+ echo "Found devbox latest version ${latest_version}."
51+ echo "latest_version=$latest_version" >> $GITHUB_ENV
52+ else
53+ echo "ERROR: unable to find the latest devbox version."
54+ exit 1
55+ fi
56+ fi
57+
58+ - name : Mount devbox cli cache
59+ id : cache-devbox-cli
60+ uses : actions/cache@v3
4661 with :
47- repository : jetpack-io/devbox
48- excludes : prerelease, draft
62+ path : /usr/local/bin/devbox
63+ key : ${{ runner.os }}-devbox-${{ env.latest_version }}
64+
65+ - name : Install devbox cli
66+ if : steps.cache-devbox-cli.outputs.cache-hit != 'true'
67+ shell : bash
68+ run : |
69+ DEVBOX_USE_VERSION="${{ env.latest_version }}"
70+ curl -fsSL https://get.jetpack.io/devbox | FORCE=1 bash
71+
72+ version=$(devbox version)
73+ if [[ ! "$version" = "$DEVBOX_USE_VERSION" ]]; then
74+ echo "ERROR: mismatch devbox version downloaded. Expected $DEVBOX_USE_VERSION, got $version."
75+ exit 1
76+ fi
77+ sudo mv ${HOME}/.cache/devbox/bin/${version}_*/devbox /usr/local/bin/devbox
4978
5079 - name : Install nix and devbox packages
5180 shell : bash
52- env :
53- DEVBOX_USE_VERSION : ${{ inputs.devbox-version }}
5481 run : |
5582 NIX_INSTALLER_NO_CHANNEL_ADD=1
5683 NIX_BUILD_SHELL=/bin/bash
57- if [[ ! -n $DEVBOX_USE_VERSION ]]; then
58- DEVBOX_USE_VERSION=${{ steps.devbox-version.outputs.release }}
59- fi
60- devbox shell --config=${{ inputs.project-path }} -- echo "Installing nix..." || true
61- source /home/runner/.nix-profile/etc/profile.d/nix.sh
62- devbox shell --config=${{ inputs.project-path }} -- echo "Installing packages..."
84+ devbox shell --config=${{ inputs.project-path }} -- echo "Packages installed!"
0 commit comments