name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
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-musl
os: ubuntu-latest
cross: false
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-latest
cross: false
- target: aarch64-apple-darwin
os: macos-latest
cross: false
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install cross
if: matrix.cross
uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build (cargo)
if: ${{ !matrix.cross }}
run: cargo build --release --target ${{ matrix.target }}
- name: Build (cross)
if: matrix.cross
run: cross build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
set -euo pipefail
mkdir -p dist
archive="upskill-${{ matrix.target }}.tar.gz"
tar czf "dist/${archive}" -C "target/${{ matrix.target }}/release" upskill
( cd dist && shasum -a 256 "${archive}" > "${archive}.sha256" )
- uses: actions/upload-artifact@v4
with:
name: upskill-${{ matrix.target }}
path: dist/*
if-no-files-found: error
release:
name: Publish release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: dist/*
fail_on_unmatched_files: true
draft: false
prerelease: false