Skip to content

Commit d393830

Browse files
committed
no more hardcoded URLs
1 parent 0733c2b commit d393830

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

.github/workflows/test_alpha_many_os.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ jobs:
1919
with:
2020
version: 0.13.0
2121

22+
- name: Get latest release info
23+
id: get_release
24+
run: |
25+
RELEASE_INFO=$(curl -s https://api.github.com/repos/roc-lang/roc/releases/latest)
26+
echo "tag_name=$(echo "$RELEASE_INFO" | jq -r .tag_name)" >> $GITHUB_OUTPUT
27+
echo "assets_url=$(echo "$RELEASE_INFO" | jq -r .assets_url)" >> $GITHUB_OUTPUT
28+
2229
- name: Delete everything except ci folder to test the release like a real user would
2330
run: find . -maxdepth 1 ! -name ci ! -name '.' -exec rm -rf {} +
2431

@@ -29,20 +36,30 @@ jobs:
2936
- name: get the latest release archive for linux (x86_64)
3037
if: startsWith(matrix.os, 'ubuntu') && !endsWith(matrix.os, '-arm')
3138
run: |
32-
curl -fL https://github.com/roc-lang/roc/releases/download/0.0.0-alpha2-rolling/roc-linux_x86_64-0-alpha2-rolling.tar.gz -o roc_release.tar.gz
39+
ASSETS_URL="${{ steps.get_release.outputs.assets_url }}"
40+
DOWNLOAD_URL=$(curl -s "$ASSETS_URL" | jq -r '.[] | select(.name | startswith("roc-linux_x86_64-") and (contains("old") | not)) | .browser_download_url')
41+
curl -fL "$DOWNLOAD_URL" -o roc_release.tar.gz
3342
3443
- name: get the latest release archive for linux (arm64)
3544
if: startsWith(matrix.os, 'ubuntu') && endsWith(matrix.os, '-arm')
3645
run: |
37-
curl -fL https://github.com/roc-lang/roc/releases/download/0.0.0-alpha2-rolling/roc-linux_arm64-0-alpha2-rolling.tar.gz -o roc_release.tar.gz
46+
ASSETS_URL="${{ steps.get_release.outputs.assets_url }}"
47+
DOWNLOAD_URL=$(curl -s "$ASSETS_URL" | jq -r '.[] | select(.name | startswith("roc-linux_arm64-") and (contains("old") | not)) | .browser_download_url')
48+
curl -fL "$DOWNLOAD_URL" -o roc_release.tar.gz
3849
3950
- name: get the latest release archive for macos 13 (x86_64)
4051
if: matrix.os == 'macos-13'
41-
run: curl -fL https://github.com/roc-lang/roc/releases/download/0.0.0-alpha2-rolling/roc-macos_x86_64-0-alpha2-rolling.tar.gz -o roc_release.tar.gz
52+
run: |
53+
ASSETS_URL="${{ steps.get_release.outputs.assets_url }}"
54+
DOWNLOAD_URL=$(curl -s "$ASSETS_URL" | jq -r '.[] | select(.name | startswith("roc-macos_x86_64-")) | .browser_download_url')
55+
curl -fL "$DOWNLOAD_URL" -o roc_release.tar.gz
4256
4357
- name: get the latest release archive for macos 14 (aarch64)
4458
if: matrix.os == 'macos-14'
45-
run: curl -fL https://github.com/roc-lang/roc/releases/download/0.0.0-alpha2-rolling/roc-macos_apple_silicon-0-alpha2-rolling.tar.gz -o roc_release.tar.gz
59+
run: |
60+
ASSETS_URL="${{ steps.get_release.outputs.assets_url }}"
61+
DOWNLOAD_URL=$(curl -s "$ASSETS_URL" | jq -r '.[] | select(.name | startswith("roc-macos_apple_silicon-")) | .browser_download_url')
62+
curl -fL "$DOWNLOAD_URL" -o roc_release.tar.gz
4663
4764
- run: zig version
4865

@@ -53,11 +70,15 @@ jobs:
5370
- name: test with old linux release (x86_64)
5471
if: startsWith(matrix.os, 'ubuntu') && !endsWith(matrix.os, '-arm')
5572
run: |
56-
curl -fL https://github.com/roc-lang/roc/releases/download/0.0.0-alpha2-rolling/roc-old_linux_x86_64-0-alpha2-rolling.tar.gz -o roc_release.tar.gz
73+
ASSETS_URL="${{ steps.get_release.outputs.assets_url }}"
74+
DOWNLOAD_URL=$(curl -s "$ASSETS_URL" | jq -r '.[] | select(.name | startswith("roc-old_linux_x86_64-")) | .browser_download_url')
75+
curl -fL "$DOWNLOAD_URL" -o roc_release.tar.gz
5776
./ci/basic_release_test.sh roc_release.tar.gz
5877
5978
- name: test with old linux release (arm64)
6079
if: startsWith(matrix.os, 'ubuntu') && endsWith(matrix.os, '-arm')
6180
run: |
62-
curl -fL https://github.com/roc-lang/roc/releases/download/0.0.0-alpha2-rolling/roc-old_linux_arm64-0-alpha2-rolling.tar.gz -o roc_release.tar.gz
81+
ASSETS_URL="${{ steps.get_release.outputs.assets_url }}"
82+
DOWNLOAD_URL=$(curl -s "$ASSETS_URL" | jq -r '.[] | select(.name | startswith("roc-old_linux_arm64-")) | .browser_download_url')
83+
curl -fL "$DOWNLOAD_URL" -o roc_release.tar.gz
6384
./ci/basic_release_test.sh roc_release.tar.gz

.github/workflows/test_nightly_many_os.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
on:
2-
pull_request:
3-
# workflow_dispatch:
2+
# pull_request:
3+
workflow_dispatch:
44

55
name: Test latest nightly releases for macOS and Linux
66

0 commit comments

Comments
 (0)