Skip to content

Commit b7d91e2

Browse files
committed
ci: use TinyGo version in artifact files
This avoids needing to rename them ourselves (which is kinda annoying) and also avoids mistakes in the process.
1 parent 8606972 commit b7d91e2

File tree

4 files changed

+47
-26
lines changed

4 files changed

+47
-26
lines changed

.github/workflows/build-macos.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
uses: actions/checkout@v4
3434
with:
3535
submodules: true
36+
- name: Extract TinyGo version
37+
id: version
38+
run: ./.github/workflows/tinygo-extract-version.sh | tee -a "$GITHUB_OUTPUT"
3639
- name: Install Go
3740
uses: actions/setup-go@v5
3841
with:
@@ -104,7 +107,7 @@ jobs:
104107
- name: Test stdlib packages
105108
run: make tinygo-test
106109
- name: Make release artifact
107-
run: cp -p build/release.tar.gz build/tinygo.darwin-${{ matrix.goarch }}.tar.gz
110+
run: cp -p build/release.tar.gz build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
108111
- name: Publish release artifact
109112
# Note: this release artifact is double-zipped, see:
110113
# https://github.com/actions/upload-artifact/issues/39
@@ -114,8 +117,8 @@ jobs:
114117
# We're doing the former here, to keep artifact uploads fast.
115118
uses: actions/upload-artifact@v4
116119
with:
117-
name: darwin-${{ matrix.goarch }}-double-zipped
118-
path: build/tinygo.darwin-${{ matrix.goarch }}.tar.gz
120+
name: darwin-${{ matrix.goarch }}-double-zipped-${{ steps.version.outputs.version }}
121+
path: build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
119122
- name: Smoke tests
120123
run: make smoketest TINYGO=$(PWD)/build/tinygo
121124
test-macos-homebrew:

.github/workflows/linux.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
runs-on: ubuntu-latest
2020
container:
2121
image: golang:1.23-alpine
22+
outputs:
23+
version: ${{ steps.version.outputs.version }}
2224
steps:
2325
- name: Install apk dependencies
2426
# tar: needed for actions/cache@v4
@@ -32,6 +34,9 @@ jobs:
3234
uses: actions/checkout@v4
3335
with:
3436
submodules: true
37+
- name: Extract TinyGo version
38+
id: version
39+
run: ./.github/workflows/tinygo-extract-version.sh | tee -a "$GITHUB_OUTPUT"
3540
- name: Cache Go
3641
uses: actions/cache@v4
3742
with:
@@ -120,15 +125,15 @@ jobs:
120125
- name: Build TinyGo release
121126
run: |
122127
make release deb -j3 STATIC=1
123-
cp -p build/release.tar.gz /tmp/tinygo.linux-amd64.tar.gz
124-
cp -p build/release.deb /tmp/tinygo_amd64.deb
128+
cp -p build/release.tar.gz /tmp/tinygo${{ steps.version.outputs.version }}.linux-amd64.tar.gz
129+
cp -p build/release.deb /tmp/tinygo_${{ steps.version.outputs.version }}_amd64.deb
125130
- name: Publish release artifact
126131
uses: actions/upload-artifact@v4
127132
with:
128-
name: linux-amd64-double-zipped
133+
name: linux-amd64-double-zipped-${{ steps.version.outputs.version }}
129134
path: |
130-
/tmp/tinygo.linux-amd64.tar.gz
131-
/tmp/tinygo_amd64.deb
135+
/tmp/tinygo${{ steps.version.outputs.version }}.linux-amd64.tar.gz
136+
/tmp/tinygo_${{ steps.version.outputs.version }}_amd64.deb
132137
test-linux-build:
133138
# Test the binaries built in the build-linux job by running the smoke tests.
134139
runs-on: ubuntu-latest
@@ -152,11 +157,11 @@ jobs:
152157
- name: Download release artifact
153158
uses: actions/download-artifact@v4
154159
with:
155-
name: linux-amd64-double-zipped
160+
name: linux-amd64-double-zipped-${{ needs.build-linux.outputs.version }}
156161
- name: Extract release tarball
157162
run: |
158163
mkdir -p ~/lib
159-
tar -C ~/lib -xf tinygo.linux-amd64.tar.gz
164+
tar -C ~/lib -xf tinygo${{ needs.build-linux.outputs.version }}.linux-amd64.tar.gz
160165
ln -s ~/lib/tinygo/bin/tinygo ~/go/bin/tinygo
161166
- run: make tinygo-test-wasip1-fast
162167
- run: make tinygo-test-wasip2-fast
@@ -297,6 +302,9 @@ jobs:
297302
steps:
298303
- name: Checkout
299304
uses: actions/checkout@v4
305+
- name: Get TinyGo version
306+
id: version
307+
run: ./.github/workflows/tinygo-extract-version.sh | tee -a "$GITHUB_OUTPUT"
300308
- name: Install apt dependencies
301309
run: |
302310
sudo apt-get update
@@ -381,24 +389,24 @@ jobs:
381389
- name: Download amd64 release
382390
uses: actions/download-artifact@v4
383391
with:
384-
name: linux-amd64-double-zipped
392+
name: linux-amd64-double-zipped-${{ needs.build-linux.outputs.version }}
385393
- name: Extract amd64 release
386394
run: |
387395
mkdir -p build/release
388-
tar -xf tinygo.linux-amd64.tar.gz -C build/release tinygo
396+
tar -xf tinygo${{ needs.build-linux.outputs.version }}.linux-amd64.tar.gz -C build/release tinygo
389397
- name: Modify release
390398
run: |
391399
cp -p build/tinygo build/release/tinygo/bin
392400
cp -p build/wasm-opt build/release/tinygo/bin
393401
- name: Create ${{ matrix.goarch }} release
394402
run: |
395403
make release deb RELEASEONLY=1 DEB_ARCH=${{ matrix.libc }}
396-
cp -p build/release.tar.gz /tmp/tinygo.linux-${{ matrix.goarch }}.tar.gz
397-
cp -p build/release.deb /tmp/tinygo_${{ matrix.libc }}.deb
404+
cp -p build/release.tar.gz /tmp/tinygo${{ steps.version.outputs.version }}.linux-${{ matrix.goarch }}.tar.gz
405+
cp -p build/release.deb /tmp/tinygo_${{ steps.version.outputs.version }}_${{ matrix.libc }}.deb
398406
- name: Publish release artifact
399407
uses: actions/upload-artifact@v4
400408
with:
401-
name: linux-${{ matrix.goarch }}-double-zipped
409+
name: linux-${{ matrix.goarch }}-double-zipped-${{ steps.version.outputs.version }}
402410
path: |
403-
/tmp/tinygo.linux-${{ matrix.goarch }}.tar.gz
404-
/tmp/tinygo_${{ matrix.libc }}.deb
411+
/tmp/tinygo${{ steps.version.outputs.version }}.linux-${{ matrix.goarch }}.tar.gz
412+
/tmp/tinygo_${{ steps.version.outputs.version }}_${{ matrix.libc }}.deb
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
# Extract the version string from the source code, to be stored in a variable.
4+
grep 'const version' goenv/version.go | sed 's/^const version = "\(.*\)"$/version=\1/g'

.github/workflows/windows.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ concurrency:
1414
jobs:
1515
build-windows:
1616
runs-on: windows-2022
17+
outputs:
18+
version: ${{ steps.version.outputs.version }}
1719
steps:
1820
- name: Configure pagefile
1921
uses: al-cheb/configure-pagefile-action@v1.4
@@ -32,6 +34,10 @@ jobs:
3234
uses: actions/checkout@v4
3335
with:
3436
submodules: true
37+
- name: Extract TinyGo version
38+
id: version
39+
shell: bash
40+
run: ./.github/workflows/tinygo-extract-version.sh | tee -a "$GITHUB_OUTPUT"
3541
- name: Install Go
3642
uses: actions/setup-go@v5
3743
with:
@@ -108,7 +114,7 @@ jobs:
108114
- name: Make release artifact
109115
shell: bash
110116
working-directory: build/release
111-
run: 7z -tzip a release.zip tinygo
117+
run: 7z -tzip a tinygo${{ steps.version.outputs.version }}.windows-amd64.zip tinygo
112118
- name: Publish release artifact
113119
# Note: this release artifact is double-zipped, see:
114120
# https://github.com/actions/upload-artifact/issues/39
@@ -118,8 +124,8 @@ jobs:
118124
# We're doing the former here, to keep artifact uploads fast.
119125
uses: actions/upload-artifact@v4
120126
with:
121-
name: windows-amd64-double-zipped
122-
path: build/release/release.zip
127+
name: windows-amd64-double-zipped-${{ steps.version.outputs.version }}
128+
path: build/release/tinygo${{ steps.version.outputs.version }}.windows-amd64.zip
123129

124130
smoke-test-windows:
125131
runs-on: windows-2022
@@ -148,12 +154,12 @@ jobs:
148154
- name: Download TinyGo build
149155
uses: actions/download-artifact@v4
150156
with:
151-
name: windows-amd64-double-zipped
157+
name: windows-amd64-double-zipped-${{ needs.build-windows.outputs.version }}
152158
path: build/
153159
- name: Unzip TinyGo build
154160
shell: bash
155161
working-directory: build
156-
run: 7z x release.zip -r
162+
run: 7z x tinygo*.windows-amd64.zip -r
157163
- name: Smoke tests
158164
shell: bash
159165
run: make smoketest TINYGO=$(PWD)/build/tinygo/bin/tinygo
@@ -178,12 +184,12 @@ jobs:
178184
- name: Download TinyGo build
179185
uses: actions/download-artifact@v4
180186
with:
181-
name: windows-amd64-double-zipped
187+
name: windows-amd64-double-zipped-${{ needs.build-windows.outputs.version }}
182188
path: build/
183189
- name: Unzip TinyGo build
184190
shell: bash
185191
working-directory: build
186-
run: 7z x release.zip -r
192+
run: 7z x tinygo*.windows-amd64.zip -r
187193
- name: Test stdlib packages
188194
run: make tinygo-test TINYGO=$(PWD)/build/tinygo/bin/tinygo
189195

@@ -214,11 +220,11 @@ jobs:
214220
- name: Download TinyGo build
215221
uses: actions/download-artifact@v4
216222
with:
217-
name: windows-amd64-double-zipped
223+
name: windows-amd64-double-zipped-${{ needs.build-windows.outputs.version }}
218224
path: build/
219225
- name: Unzip TinyGo build
220226
shell: bash
221227
working-directory: build
222-
run: 7z x release.zip -r
228+
run: 7z x tinygo*.windows-amd64.zip -r
223229
- name: Test stdlib packages on wasip1
224230
run: make tinygo-test-wasip1-fast TINYGO=$(PWD)/build/tinygo/bin/tinygo

0 commit comments

Comments
 (0)