Skip to content

v1.1.0: UI refinement — scrollable help, playback position, parameter… #24

v1.1.0: UI refinement — scrollable help, playback position, parameter…

v1.1.0: UI refinement — scrollable help, playback position, parameter… #24

Workflow file for this run

name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
BINARY_NAME: classcii
jobs:
validate:
name: Validate tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v6
- name: Extract and validate version
id: version
shell: bash
run: |
TAG="${GITHUB_REF_NAME}"
TAG_VERSION="${TAG#v}"
CARGO_VERSION=$(grep -m1 '^version' Cargo.toml | sed 's/.*"\(.*\)"/\1/')
echo "Tag version: ${TAG_VERSION}"
echo "Cargo version: ${CARGO_VERSION}"
if [ "${TAG_VERSION}" != "${CARGO_VERSION}" ]; then
echo "::error::Tag version (${TAG_VERSION}) does not match Cargo.toml version (${CARGO_VERSION})"
exit 1
fi
echo "version=${TAG_VERSION}" >> "$GITHUB_OUTPUT"
build:
name: Build (${{ matrix.target }})
needs: validate
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
ext: .exe
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
ext: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: release-${{ matrix.target }}
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libasound2-dev libgtk-3-dev
- name: Build
run: cargo build --release --features video
- name: Package (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
ASSET_NAME="${BINARY_NAME}-v${{ needs.validate.outputs.version }}-${{ matrix.target }}"
mkdir -p "${ASSET_NAME}"
cp "target/release/${BINARY_NAME}" "${ASSET_NAME}/"
cp README.md LICENSE "${ASSET_NAME}/"
cp -r config/ "${ASSET_NAME}/config/"
tar czf "${ASSET_NAME}.tar.gz" "${ASSET_NAME}"
echo "ASSET=${ASSET_NAME}.tar.gz" >> "$GITHUB_ENV"
- name: Package (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
ASSET_NAME="${BINARY_NAME}-v${{ needs.validate.outputs.version }}-${{ matrix.target }}"
mkdir -p "${ASSET_NAME}"
cp "target/release/${BINARY_NAME}.exe" "${ASSET_NAME}/"
cp README.md LICENSE "${ASSET_NAME}/"
cp -r config/ "${ASSET_NAME}/config/"
7z a "${ASSET_NAME}.zip" "${ASSET_NAME}"
echo "ASSET=${ASSET_NAME}.zip" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: ${{ env.ASSET }}
if-no-files-found: error
release:
name: GitHub Release
needs: [validate, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -la artifacts/
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: v${{ needs.validate.outputs.version }}
generate_release_notes: true
files: artifacts/*