name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build-and-release:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libasound2-dev \
pkg-config \
dpkg-dev \
rpm \
xz-utils
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install release tools
run: |
cargo install cargo-dist --locked --version 0.30.3
cargo install cargo-deb --locked
cargo install cargo-generate-rpm --locked
- name: Build tar.xz via dist
run: |
dist build \
--allow-dirty \
--artifacts=local \
--target x86_64-unknown-linux-gnu \
--tag "${GITHUB_REF_NAME}"
- name: Build .deb
run: cargo deb
- name: Build .rpm
run: |
cargo build --release
cargo generate-rpm
- name: Collect artifacts
run: |
set -euo pipefail
mkdir -p target/release-artifacts
# tarballs (cargo-dist)
if compgen -G "target/distrib/*.tar.xz" > /dev/null; then
cp -v target/distrib/*.tar.xz* target/release-artifacts/
elif compgen -G "target/dist/*.tar.xz" > /dev/null; then
cp -v target/dist/*.tar.xz* target/release-artifacts/
else
echo "ERROR: couldn't find dist tarballs in target/distrib or target/dist" >&2
find target -maxdepth 3 -type f -name '*.tar.xz' -print || true
exit 1
fi
# deb/rpm
cp -v target/debian/*.deb target/release-artifacts/
cp -v target/generate-rpm/*.rpm target/release-artifacts/
- name: Upload assets to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: target/release-artifacts/*
fail_on_unmatched_files: true
generate_release_notes: true