Skip to content

Commit b3683ff

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 2a76ceb commit b3683ff

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

.github/workflows/build-macos.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
uses: actions/checkout@v4
3535
with:
3636
submodules: true
37+
- name: Get TinyGo version
38+
id: version
39+
run: ./.github/workflows/tinygo-extract-version.sh >> "$GITHUB_OUTPUT"
3740
- name: Install Go
3841
uses: actions/setup-go@v5
3942
with:
@@ -108,7 +111,7 @@ jobs:
108111
run: make tinygo-test
109112
- name: Make release artifact
110113
shell: bash
111-
run: cp -p build/release.tar.gz build/tinygo.darwin-${{ matrix.goarch }}.tar.gz
114+
run: cp -p build/release.tar.gz build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
112115
- name: Publish release artifact
113116
# Note: this release artifact is double-zipped, see:
114117
# https://github.com/actions/upload-artifact/issues/39
@@ -118,8 +121,8 @@ jobs:
118121
# We're doing the former here, to keep artifact uploads fast.
119122
uses: actions/upload-artifact@v4
120123
with:
121-
name: darwin-${{ matrix.goarch }}-double-zipped
122-
path: build/tinygo.darwin-${{ matrix.goarch }}.tar.gz
124+
name: darwin-${{ matrix.goarch }}-double-zipped-${{ steps.version.outputs.version }}
125+
path: build/tinygo${{ steps.version.outputs.version }}.darwin-${{ matrix.goarch }}.tar.gz
123126
- name: Smoke tests
124127
shell: bash
125128
run: make smoketest TINYGO=$(PWD)/build/tinygo

.github/workflows/linux.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
uses: actions/checkout@v4
3333
with:
3434
submodules: true
35+
- name: Get TinyGo version
36+
id: version
37+
run: ./.github/workflows/tinygo-extract-version.sh >> "$GITHUB_OUTPUT"
3538
- name: Cache Go
3639
uses: actions/cache@v4
3740
with:
@@ -120,15 +123,15 @@ jobs:
120123
- name: Build TinyGo release
121124
run: |
122125
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
126+
cp -p build/release.tar.gz /tmp/tinygo${{ steps.version.outputs.version }}.linux-amd64.tar.gz
127+
cp -p build/release.deb /tmp/tinygo_${{ steps.version.outputs.version }}_amd64.deb
125128
- name: Publish release artifact
126129
uses: actions/upload-artifact@v4
127130
with:
128-
name: linux-amd64-double-zipped
131+
name: linux-amd64-double-zipped-${{ steps.version.outputs.version }}
129132
path: |
130-
/tmp/tinygo.linux-amd64.tar.gz
131-
/tmp/tinygo_amd64.deb
133+
/tmp/tinygo${{ steps.version.outputs.version }}.linux-amd64.tar.gz
134+
/tmp/tinygo_${{ steps.version.outputs.version }}_amd64.deb
132135
test-linux-build:
133136
# Test the binaries built in the build-linux job by running the smoke tests.
134137
runs-on: ubuntu-latest
@@ -297,6 +300,9 @@ jobs:
297300
steps:
298301
- name: Checkout
299302
uses: actions/checkout@v4
303+
- name: Get TinyGo version
304+
id: version
305+
run: ./.github/workflows/tinygo-extract-version.sh >> "$GITHUB_OUTPUT"
300306
- name: Install apt dependencies
301307
run: |
302308
sudo apt-get update
@@ -393,12 +399,12 @@ jobs:
393399
- name: Create ${{ matrix.goarch }} release
394400
run: |
395401
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
402+
cp -p build/release.tar.gz /tmp/tinygo${{ steps.version.outputs.version }}.linux-${{ matrix.goarch }}.tar.gz
403+
cp -p build/release.deb /tmp/tinygo_${{ steps.version.outputs.version }}_${{ matrix.libc }}.deb
398404
- name: Publish release artifact
399405
uses: actions/upload-artifact@v4
400406
with:
401-
name: linux-${{ matrix.goarch }}-double-zipped
407+
name: linux-${{ matrix.goarch }}-double-zipped-${{ steps.version.outputs.version }}
402408
path: |
403-
/tmp/tinygo.linux-${{ matrix.goarch }}.tar.gz
404-
/tmp/tinygo_${{ matrix.libc }}.deb
409+
/tmp/tinygo${{ steps.version.outputs.version }}.linux-${{ matrix.goarch }}.tar.gz
410+
/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: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
uses: actions/checkout@v4
3333
with:
3434
submodules: true
35+
- name: Get TinyGo version
36+
id: version
37+
shell: bash
38+
run: ./.github/workflows/tinygo-extract-version.sh >> "$GITHUB_OUTPUT"
3539
- name: Install Go
3640
uses: actions/setup-go@v5
3741
with:
@@ -108,7 +112,7 @@ jobs:
108112
- name: Make release artifact
109113
shell: bash
110114
working-directory: build/release
111-
run: 7z -tzip a release.zip tinygo
115+
run: 7z -tzip a tinygo${{ steps.version.outputs.version }}.windows-amd64.zip tinygo
112116
- name: Publish release artifact
113117
# Note: this release artifact is double-zipped, see:
114118
# https://github.com/actions/upload-artifact/issues/39
@@ -118,8 +122,8 @@ jobs:
118122
# We're doing the former here, to keep artifact uploads fast.
119123
uses: actions/upload-artifact@v4
120124
with:
121-
name: windows-amd64-double-zipped
122-
path: build/release/release.zip
125+
name: windows-amd64-double-zipped-${{ steps.version.outputs.version }}
126+
path: build/release/tinygo${{ steps.version.outputs.version }}.windows-amd64.zip
123127

124128
smoke-test-windows:
125129
runs-on: windows-2022

0 commit comments

Comments
 (0)