Skip to content

Build

Build #14

Workflow file for this run

---
name: Build
on:
release:
types: [published]
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
COLUMNS: 120
jobs:
cargo-build:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: "${{ matrix.target }}"
- uses: Swatinem/rust-cache@v2
- name: Print versions
shell: bash
run: |
gcc --version || true
rustup -V
rustup toolchain list
rustup default
cargo -V
rustc -V
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --target ${{ matrix.target }}
- name: Create Release Tar Archive
run: >-
tar -czvf "hanko-${GITHUB_REF#refs/tags/}-${{ matrix.target }}.tar.gz"
-C target/${{ matrix.target }}/release
hanko
shell: bash
if: ${{ !startsWith(matrix.os, 'windows') }}
- name: Create Release Zip Archive
run: >-
7z a "hanko-${GITHUB_REF#refs/tags/}-${{ matrix.target }}.zip"
target/${{ matrix.target }}/release/hanko.exe
shell: bash
if: ${{ startsWith(matrix.os, 'windows') }}
- name: Upload Release Archive
run: >-
gh release upload "${GITHUB_REF#refs/tags/}"
"hanko-${GITHUB_REF#refs/tags/}-${{ matrix.target }}.${FILE_EXTENSION}"
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILE_EXTENSION: ${{ startsWith(matrix.os, 'windows') && 'zip' || 'tar.gz' }}