name: Release
on:
release:
types: [published]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo test --verbose
publish:
name: Publish to crates.io
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish
build-binaries:
name: Build ${{ matrix.target }}
needs: test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact: fuse
- target: x86_64-apple-darwin
os: macos-latest
artifact: fuse
- target: aarch64-apple-darwin
os: macos-latest
artifact: fuse
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: fuse.exe
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Create archive (Unix)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar -czvf ../../../fuse-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ${{ matrix.artifact }}
- name: Create archive (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../fuse-${{ github.ref_name }}-${{ matrix.target }}.zip ${{ matrix.artifact }}
- name: Upload to release
uses: softprops/action-gh-release@v1
with:
files: |
fuse-${{ github.ref_name }}-${{ matrix.target }}.*