diff --git a/.github/workflows/test_nightly_macos_apple_silicon.yml b/.github/workflows/test_nightly_macos_apple_silicon.yml index 0e6d765907..d84f818bda 100644 --- a/.github/workflows/test_nightly_macos_apple_silicon.yml +++ b/.github/workflows/test_nightly_macos_apple_silicon.yml @@ -16,7 +16,7 @@ jobs: run: curl https://api.github.com/repos/roc-lang/roc/releases > roc_releases.json - name: get the url of today`s release for macos apple silicon - run: echo "RELEASE_URL=$(./ci/get_latest_release_url.sh silicon)" >> $GITHUB_ENV + run: echo "RELEASE_URL=$(./ci/get_today_release_url.sh silicon)" >> $GITHUB_ENV - name: Get the archive from the url. run: curl -OL ${{ env.RELEASE_URL }} diff --git a/.github/workflows/test_nightly_many_os.yml b/.github/workflows/test_nightly_many_os.yml index 11127bc11a..10734325c8 100644 --- a/.github/workflows/test_nightly_many_os.yml +++ b/.github/workflows/test_nightly_many_os.yml @@ -29,11 +29,11 @@ jobs: - name: get the url of today`s release for linux (x86_64) if: startsWith(matrix.os, 'ubuntu') - run: echo "RELEASE_URL=$(./ci/get_latest_release_url.sh linux_x86_64)" >> $GITHUB_ENV + run: echo "RELEASE_URL=$(./ci/get_today_release_url.sh linux_x86_64)" >> $GITHUB_ENV - name: get the url of today`s release for macos (x86_64) if: startsWith(matrix.os, 'macos') - run: echo "RELEASE_URL=$(./ci/get_latest_release_url.sh macos_x86_64)" >> $GITHUB_ENV + run: echo "RELEASE_URL=$(./ci/get_today_release_url.sh macos_x86_64)" >> $GITHUB_ENV - name: get the archive from the url run: curl -OL ${{ env.RELEASE_URL }} diff --git a/ci/get_latest_release_url.sh b/ci/get_latest_release_url.sh index 3d8e5f26b5..afd5950bbf 100755 --- a/ci/get_latest_release_url.sh +++ b/ci/get_latest_release_url.sh @@ -5,12 +5,12 @@ # https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ set -euxo pipefail -LATEST_RELEASE_URL=`cat roc_releases.json | jq --arg arch $1 --arg today $(date +'%Y-%m-%d') '.[0] | .assets | map(.browser_download_url) | map(select(. | contains("\($arch)-\($today)"))) | .[0]'` +LATEST_RELEASE_URL=`cat roc_releases.json | jq --arg arch $1 '.[0] | .assets | map(.browser_download_url) | map(select(. | contains("\($arch)-"))) | last'` if [[ "$LATEST_RELEASE_URL" == "null" ]] then - echo "I expected to get a url but I got null instead. Today's release may not have been uploaded?" + echo "I expected to get a url but I got null instead. The provided argument for this bash script may not have had any matches when used as arch in the jq query above." exit 1 else echo $LATEST_RELEASE_URL | sed s/\"//g -fi \ No newline at end of file +fi diff --git a/ci/get_today_release_url.sh b/ci/get_today_release_url.sh new file mode 100755 index 0000000000..7a9386f565 --- /dev/null +++ b/ci/get_today_release_url.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# assumes roc_releases.json is present + +# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/ +set -euxo pipefail + +TODAY_RELEASE_URL=`cat roc_releases.json | jq --arg arch $1 --arg today $(date +'%Y-%m-%d') '.[0] | .assets | map(.browser_download_url) | map(select(. | contains("\($arch)-\($today)"))) | .[0]'` + +if [[ "$TODAY_RELEASE_URL" == "null" ]] +then + echo "I expected to get a url but I got null instead. Today's release may not have been uploaded?" + exit 1 +else + echo $TODAY_RELEASE_URL | sed s/\"//g +fi diff --git a/www/build.sh b/www/build.sh index f664aac337..e5bff959e4 100755 --- a/www/build.sh +++ b/www/build.sh @@ -52,11 +52,26 @@ mv generated-docs/ www/build/builtins # move all the folders to build/builtins/ # Manually add this tip to all the builtin docs. find www/build/builtins -type f -name 'index.html' -exec sed -i 's!!