name: Release on: push: tags: - 'v*' permissions: contents: write jobs: release: name: Release runs-on: ${{ matrix.os }} strategy: matrix: include: - os: ubuntu-latest target: x86_64-unknown-linux-gnu artifact_name: ntu asset_name: ntu-linux-x86_64 - os: ubuntu-latest target: x86_64-unknown-linux-musl artifact_name: ntu asset_name: ntu-linux-x86_64-musl - os: macos-latest target: x86_64-apple-darwin artifact_name: ntu asset_name: ntu-macos-x86_64 - os: macos-latest target: aarch64-apple-darwin artifact_name: ntu asset_name: ntu-macos-arm64 steps: - uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@stable with: target: ${{ matrix.target }} - name: Install musl-tools (Linux musl only) if: matrix.target == 'x86_64-unknown-linux-musl' run: sudo apt-get update && sudo apt-get install -y musl-tools - name: Build run: cargo build --release --target ${{ matrix.target }} - name: Strip binary (Linux only) if: startsWith(matrix.os, 'ubuntu') run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }} - name: Compress binary run: | cd target/${{ matrix.target }}/release tar czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }} mv ${{ matrix.asset_name }}.tar.gz ../../.. - name: Upload binary to release uses: softprops/action-gh-release@v2 with: files: ${{ matrix.asset_name }}.tar.gz body_path: CHANGELOG.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}