Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: build / ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross-deps: gcc-aarch64-linux-gnu
linker: aarch64-linux-gnu-gcc
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross-compile toolchain
if: matrix.cross-deps
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.cross-deps }}
mkdir -p .cargo
echo '[target.${{ matrix.target }}]' >> .cargo/config.toml
echo 'linker = "${{ matrix.linker }}"' >> .cargo/config.toml
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package (unix)
if: runner.os != 'Windows'
shell: bash
run: |
name="fastrs-${GITHUB_REF_NAME}-${{ matrix.target }}"
mkdir "$name"
cp "target/${{ matrix.target }}/release/fastrs" "$name/"
cp README.md LICENSE "$name/"
tar czf "$name.tar.gz" "$name"
shasum -a 256 "$name.tar.gz" > "$name.tar.gz.sha256"
- name: Package (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$name = "fastrs-$env:GITHUB_REF_NAME-${{ matrix.target }}"
New-Item -ItemType Directory -Path $name | Out-Null
Copy-Item "target/${{ matrix.target }}/release/fastrs.exe" "$name/"
Copy-Item README.md, LICENSE "$name/"
Compress-Archive -Path $name -DestinationPath "$name.zip"
(Get-FileHash -Algorithm SHA256 "$name.zip").Hash | Out-File -Encoding ascii "$name.zip.sha256"
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
files: |
fastrs-*.tar.gz
fastrs-*.tar.gz.sha256
fastrs-*.zip
fastrs-*.zip.sha256