chore: correct cross
metadata key in Cargo.toml
. (#30)
#6
Workflow file for this run
This file contains 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 | |
on: | |
push: | |
tags: | |
- sprocket-v* | |
jobs: | |
release: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update Rust | |
run: rustup update stable && rustup default stable | |
- name: Update lock file | |
run: cargo update | |
- name: Publish to crates.io | |
run: cargo publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
- name: Create a GH release | |
uses: softprops/action-gh-release@v2 | |
with: | |
generate_release_notes: true | |
make_latest: true | |
build_artifacts: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- rust-target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
extension: tar.gz | |
- rust-target: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: true | |
extension: tar.gz | |
- rust-target: x86_64-apple-darwin | |
os: macos-latest | |
extension: tar.gz | |
- rust-target: aarch64-apple-darwin | |
os: macos-latest | |
extension: tar.gz | |
- rust-target: x86_64-pc-windows-gnu | |
os: windows-latest | |
extension: zip | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update Rust | |
run: rustup update stable && rustup default stable && rustup target add ${{ matrix.rust-target }} | |
- run: cargo build --release --target ${{ matrix.rust-target }} | |
if: ${{ ! matrix.cross }} | |
- run: cargo install cross | |
if: ${{ matrix.cross }} | |
- run: cross build --release --target ${{ matrix.rust-target }} | |
if: ${{ matrix.cross }} | |
- run: tar -czvf sprocket-${{ matrix.rust-target }}.tar.gz sprocket | |
working-directory: ./target/${{ matrix.rust-target }}/release | |
if: matrix.os != 'windows-latest' | |
- run: 7z a sprocket-${{ matrix.rust-target }}.zip sprocket.exe | |
working-directory: ./target/${{ matrix.rust-target }}/release | |
if: matrix.os == 'windows-latest' | |
- name: Update the GH release with the new artifact | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: ./target/${{ matrix.rust-target }}/release/sprocket-${{ matrix.rust-target }}.${{ matrix.extension }} |