Skip to content

Commit 703243a

Browse files
committed
Fix release workflow: use cross for Linux musl targets
1 parent 8431759 commit 703243a

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
name: Build ${{ matrix.target }}
1414
runs-on: ${{ matrix.os }}
1515
strategy:
16+
fail-fast: false
1617
matrix:
1718
include:
1819
- target: x86_64-unknown-linux-musl
@@ -34,35 +35,35 @@ jobs:
3435
steps:
3536
- uses: actions/checkout@v4
3637

37-
- uses: dtolnay/rust-toolchain@stable
38+
- uses: dtolnay/rust-toolchain@1.94.0
3839
with:
3940
targets: ${{ matrix.target }}
4041

41-
- name: Install musl tools (Linux)
42-
if: contains(matrix.target, 'musl')
43-
run: sudo apt-get install -y musl-tools
44-
45-
- name: Install cross-compiler (aarch64 Linux)
46-
if: matrix.target == 'aarch64-unknown-linux-musl'
47-
run: |
48-
sudo apt-get install -y gcc-aarch64-linux-gnu
49-
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
42+
- name: Install cross (Linux musl)
43+
if: runner.os == 'Linux'
44+
uses: taiki-e/install-action@v2
45+
with:
46+
tool: cross
5047

5148
- uses: Swatinem/rust-cache@v2
5249
with:
5350
key: ${{ matrix.target }}
5451

55-
- name: Build
52+
- name: Build (Linux via cross)
53+
if: runner.os == 'Linux'
54+
run: cross build --release --target ${{ matrix.target }} -p molprint-cli
55+
56+
- name: Build (macOS / Windows)
57+
if: runner.os != 'Linux'
5658
run: cargo build --release --target ${{ matrix.target }} -p molprint-cli
5759

5860
- name: Package (Unix)
5961
if: matrix.archive == 'tar.gz'
6062
shell: bash
6163
run: |
62-
BIN=molprint
6364
STAGING="molprint-${{ github.ref_name }}-${{ matrix.target }}"
6465
mkdir "$STAGING"
65-
cp "target/${{ matrix.target }}/release/$BIN" "$STAGING/"
66+
cp "target/${{ matrix.target }}/release/molprint" "$STAGING/"
6667
cp README.md "$STAGING/"
6768
tar -czf "$STAGING.tar.gz" "$STAGING"
6869
echo "ASSET=$STAGING.tar.gz" >> $GITHUB_ENV
@@ -76,7 +77,7 @@ jobs:
7677
Copy-Item "target\${{ matrix.target }}\release\molprint.exe" "$STAGING\"
7778
Copy-Item "README.md" "$STAGING\"
7879
Compress-Archive -Path "$STAGING\*" -DestinationPath "$STAGING.zip"
79-
echo "ASSET=$STAGING.zip" | Out-File -Append -FilePath $env:GITHUB_ENV
80+
"ASSET=$STAGING.zip" | Out-File -Append -FilePath $env:GITHUB_ENV
8081
8182
- name: Upload artifact
8283
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)