Merge pull request #3 from hack-ink/release/ci-packaging #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| permissions: | |
| contents: write | |
| env: | |
| CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: full | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target.name }} package | |
| runs-on: ${{ matrix.target.os }} | |
| strategy: | |
| matrix: | |
| target: | |
| [ | |
| { name: aarch64-apple-darwin, os: macos-latest, binary: airseed }, | |
| { name: x86_64-unknown-linux-musl, os: ubuntu-latest, binary: airseed }, | |
| { name: x86_64-pc-windows-msvc, os: windows-latest, binary: airseed.exe }, | |
| ] | |
| steps: | |
| - name: Fetch latest code | |
| uses: actions/checkout@v6 | |
| - name: Set up Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| cache: true | |
| components: rustfmt, clippy | |
| - name: Add target | |
| run: rustup target add ${{ matrix.target.name }} | |
| - name: Install musl toolchain | |
| if: matrix.target.name == 'x86_64-unknown-linux-musl' | |
| run: sudo apt-get update && sudo apt-get install --yes musl-tools | |
| - name: Build | |
| run: cargo build --profile final-release --locked --target ${{ matrix.target.name }} | |
| - name: Pack (macOS) | |
| if: matrix.target.os == 'macos-latest' | |
| run: | | |
| mv target/${{ matrix.target.name }}/final-release/${{ matrix.target.binary }} airseed-${{ matrix.target.name }} | |
| - name: Pack (Windows) | |
| if: matrix.target.os == 'windows-latest' | |
| run: | | |
| mv target/${{ matrix.target.name }}/final-release/${{ matrix.target.binary }} airseed-${{ matrix.target.name }}.exe | |
| - name: Pack (Linux) | |
| if: matrix.target.os == 'ubuntu-latest' | |
| run: | | |
| mv target/${{ matrix.target.name }}/final-release/${{ matrix.target.binary }} airseed-${{ matrix.target.name }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: airseed-${{ matrix.target.name }} | |
| path: airseed-${{ matrix.target.name }}* | |
| retention-days: 1 | |
| # release: | |
| # name: Release | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - name: Publish | |
| # uses: softprops/action-gh-release@v2 | |
| # with: | |
| # discussion_category_name: Announcements | |
| # generate_release_notes: true | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: github.ref_type == 'tag' | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v8 | |
| - name: Hash | |
| run: | | |
| mkdir -p artifacts | |
| mv airseed-*/* artifacts/ | |
| cd artifacts | |
| sha256sum * | tee ../SHA256 | |
| md5sum * | tee ../MD5 | |
| mv ../SHA256 . | |
| mv ../MD5 . | |
| - name: Publish | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| discussion_category_name: Announcements | |
| generate_release_notes: true | |
| files: artifacts/* | |
| publish-on-crates-io: | |
| name: Publish on crates.io | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Fetch latest code | |
| uses: actions/checkout@v6 | |
| - name: Set up Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| cache: true | |
| components: rustfmt, clippy | |
| - name: Login | |
| run: cargo login ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| - name: Publish | |
| run: cargo publish --locked |