Skip to content

Commit 22e8366

Browse files
ci: prevent release workflow from publishing if musl build fails
1 parent 75de99e commit 22e8366

File tree

1 file changed

+41
-19
lines changed

1 file changed

+41
-19
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,39 @@ permissions:
1010
contents: write
1111

1212
jobs:
13+
build-musl-binaries:
14+
strategy:
15+
matrix:
16+
include:
17+
- target: x86_64-unknown-linux-musl
18+
runner: ubuntu-24.04
19+
- target: aarch64-unknown-linux-musl
20+
runner: codspeedhq-arm64-ubuntu-24.04
21+
22+
runs-on: ${{ matrix.runner }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
submodules: true
27+
fetch-depth: 0
28+
- uses: moonrepo/setup-rust@v1
29+
with:
30+
targets: ${{ matrix.target }}
31+
32+
- name: Install musl tools
33+
run: sudo apt-get update && sudo apt-get install -y musl-tools
34+
35+
- run: cargo build --locked --release --bin cargo-codspeed --target ${{ matrix.target }}
36+
37+
- name: Upload binary as artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: cargo-codspeed-${{ matrix.target }}
41+
path: ./target/${{ matrix.target }}/release/cargo-codspeed
42+
if-no-files-found: error
43+
1344
publish:
45+
needs: build-musl-binaries
1446
runs-on: ubuntu-latest
1547
steps:
1648
- uses: actions/checkout@v4
@@ -41,35 +73,25 @@ jobs:
4173
outputs:
4274
upload_url: ${{ steps.create_release.outputs.upload_url }}
4375

44-
build-upload-binaries:
76+
upload-binaries:
4577
needs: publish
4678
strategy:
4779
fail-fast: false
4880
matrix:
49-
include:
50-
- target: x86_64-unknown-linux-musl
51-
runner: ubuntu-24.04
52-
- target: aarch64-unknown-linux-musl
53-
runner: codspeedhq-arm64-ubuntu-24.04
81+
target:
82+
- x86_64-unknown-linux-musl
83+
- aarch64-unknown-linux-musl
5484

55-
runs-on: ${{ matrix.runner }}
85+
runs-on: ubuntu-latest
5686
steps:
57-
- uses: actions/checkout@v4
87+
- name: Download binary artifact
88+
uses: actions/download-artifact@v4
5889
with:
59-
submodules: true
60-
fetch-depth: 0
61-
- uses: moonrepo/setup-rust@v1
62-
with:
63-
targets: ${{ matrix.target }}
64-
65-
- name: Install musl tools
66-
run: sudo apt-get update && sudo apt-get install -y musl-tools
67-
68-
- run: cargo build --locked --release --bin cargo-codspeed --target ${{ matrix.target }}
90+
name: cargo-codspeed-${{ matrix.target }}
91+
path: ./target/${{ matrix.target }}/release
6992

7093
- name: Upload Release Asset
7194
if: github.event_name != 'workflow_dispatch'
72-
id: upload-release-asset
7395
uses: actions/upload-release-asset@v1
7496
env:
7597
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)