Release #2
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: | |
branches: ["main"] | |
tags: | |
- "v*" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
release_build_and_publish: | |
name: Release build and publish | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- rust-target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
- rust-target: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
cross: true | |
- rust-target: x86_64-apple-darwin | |
os: macos-latest | |
- rust-target: aarch64-apple-darwin | |
os: macos-latest | |
- rust-target: x86_64-pc-windows-gnu | |
os: windows-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update stable --no-self-update && 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 }} | |
- name: Archive .exe | |
if: matrix.os == 'windows-latest' | |
run: tar -czf fungi-${{ matrix.rust-target }}.tar.gz -C target/${{ matrix.rust-target }}/release fungi.exe | |
- name: Archive | |
if: matrix.os != 'windows-latest' | |
run: tar -czf fungi-${{ matrix.rust-target }}.tar.gz -C target/${{ matrix.rust-target }}/release fungi | |
- name: GH publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload -R ${{ github.repository }} --clobber ${{ github.ref_name }} fungi-${{ matrix.rust-target }}.tar.gz |