diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-03-27 22:50:05 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-03-27 22:51:25 +0300 |
| commit | 4955dd6024f0642e989302df8621c5197e7023db (patch) | |
| tree | 617a213c7182b374449b69dc8364962624cf7695 /.github/workflows/release.yml | |
| parent | 9aa50f04a9d5724cda773d609cf9a9154a01f256 (diff) | |
harden release workflow: musl builds, --locked, version check, portable sed
Diffstat (limited to '.github/workflows/release.yml')
| -rw-r--r-- | .github/workflows/release.yml | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75047cdd..6c4f1ffc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,15 +8,18 @@ on: permissions: contents: write +env: + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + jobs: build: strategy: matrix: include: - - target: x86_64-unknown-linux-gnu + - target: x86_64-unknown-linux-musl os: ubuntu-latest name: herdr-linux-x86_64 - - target: aarch64-unknown-linux-gnu + - target: aarch64-unknown-linux-musl os: ubuntu-latest name: herdr-linux-aarch64 - target: x86_64-apple-darwin @@ -31,20 +34,35 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Verify tag matches Cargo.toml version + run: | + CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') + TAG_VERSION="${GITHUB_REF_NAME#v}" + if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then + echo "error: tag $GITHUB_REF_NAME doesn't match Cargo.toml version $CARGO_VERSION" + exit 1 + fi + - name: Install Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} + - name: Install musl tools (Linux x86_64) + if: matrix.target == 'x86_64-unknown-linux-musl' + run: sudo apt-get update && sudo apt-get install -y musl-tools + - name: Install cross-compilation tools (Linux aarch64) - if: matrix.target == 'aarch64-unknown-linux-gnu' + if: matrix.target == 'aarch64-unknown-linux-musl' run: | sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu - echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV + sudo apt-get install -y gcc-aarch64-linux-gnu musl-tools + # Install aarch64 musl cross-compiler + sudo apt-get install -y crossbuild-essential-arm64 + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV - name: Build - run: cargo build --release --target ${{ matrix.target }} + run: cargo build --release --locked --target ${{ matrix.target }} - name: Rename binary run: cp target/${{ matrix.target }}/release/herdr ${{ matrix.name }} |
