name: release
on:
push:
tags: ["[0-9]+.[0-9]+.[0-9]+"]
workflow_dispatch:
inputs:
tag:
description: An existing tag to release, such as 0.6.0; empty builds the branch without releasing
required: false
default: ""
permissions:
contents: read
env:
TAG: ${{ github.event_name == 'push' && github.ref_name || inputs.tag }}
CARGO_TERM_COLOR: always
jobs:
check:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v7
with:
ref: ${{ env.TAG || github.sha }}
- name: The tag matches the version in Cargo.toml
if: env.TAG != ''
run: |
version=$(sed -n 's/^version = "\(.*\)"$/\1/p' Cargo.toml | head -1)
if [ "$version" != "$TAG" ]; then
echo "tag $TAG does not match version $version in Cargo.toml"
exit 1
fi
- name: Release notes from CHANGELOG.md
if: env.TAG != ''
run: |
awk -v v="$TAG" '$0 == "## [" v "]" {found = 1; next} found && /^## \[/ {exit} found' CHANGELOG.md > notes.md
if ! grep -q '[^[:space:]]' notes.md; then
echo "CHANGELOG.md has no ## [$TAG] section"
exit 1
fi
- uses: actions/upload-artifact@v7
if: env.TAG != ''
with:
name: notes
path: notes.md
- name: Install ALSA headers and window libraries
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libxkbcommon-dev libwayland-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- uses: dtolnay/rust-toolchain@stable
- name: Test, with and without Opus
run: make test
build:
needs: check
strategy:
fail-fast: false
matrix:
include:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-22.04 }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-22.04-arm }
- { target: aarch64-apple-darwin, os: macos-latest }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: x86_64-pc-windows-msvc, os: windows-latest }
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: "11.0"
steps:
- uses: actions/checkout@v7
with:
ref: ${{ env.TAG || github.sha }}
- name: Install ALSA headers and window libraries
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libxkbcommon-dev libwayland-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }} -p playr -p playr-gui -p playr-server --features playr/opus,playr-gui/opus,playr-server/opus
- name: Package
shell: bash
run: packaging/package.sh ${{ matrix.target }} "${TAG:-$(git rev-parse --short HEAD)}"
- uses: actions/upload-artifact@v7
with:
name: playr-${{ matrix.target }}
path: playr-*-${{ matrix.target }}.*
- uses: astral-sh/setup-uv@v10.1.0
if: matrix.target == 'x86_64-unknown-linux-gnu'
with:
enable-cache: false
- name: TouchOSC layout
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
target/${{ matrix.target }}/release/playr-server osc-schema > osc-schema.json
uv run packaging/touchosc/layout.py osc-schema.json "playr-${TAG:-$(git rev-parse --short HEAD)}-touchosc.tosc"
- uses: actions/upload-artifact@v7
if: matrix.target == 'x86_64-unknown-linux-gnu'
with:
name: playr-touchosc
path: playr-*-touchosc.tosc
release:
needs: build
if: github.event_name == 'push' || inputs.tag != ''
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Checksums
working-directory: dist
run: sha256sum playr-* > SHA256SUMS
- name: Publish the release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$TAG" dist/playr-* dist/SHA256SUMS \
--repo "${{ github.repository }}" \
--verify-tag \
--title "$TAG" \
--notes-file dist/notes.md