name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-22.04-arm, target: aarch64-unknown-linux-gnu }
- { os: macos-latest, target: aarch64-apple-darwin }
- { os: macos-latest, target: x86_64-apple-darwin }
- { os: windows-latest, target: x86_64-pc-windows-msvc }
- { os: windows-latest, target: aarch64-pc-windows-msvc }
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
name=neyuki-${GITHUB_REF_NAME}-${{ matrix.target }}
mkdir "$name"
cp LICENSE README.md "$name/"
if [[ "${{ matrix.target }}" == *windows* ]]; then
cp target/${{ matrix.target }}/release/neyuki.exe "$name/"
7z a "$name.zip" "$name"
else
cp target/${{ matrix.target }}/release/neyuki "$name/"
tar czf "$name.tar.gz" "$name"
fi
- uses: actions/upload-artifact@v4
with:
name: neyuki-${{ matrix.target }}
path: |
neyuki-*.tar.gz
neyuki-*.zip
release:
name: Publish release
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true