Add CI and release GitHub Actions workflows
* ci.yml: on pull requests to main, runs on windows-latest and macos-latest; checks formatting, runs clippy (warnings denied), and runs the unit tests (`cargo test --workspace`). * release.yml: manual workflow_dispatch (tag + optional prerelease inputs); builds release binaries for Windows (x86_64) and macOS (aarch64 + x86_64), then publishes them to GitHub Releases with auto-generated notes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Release tag, e.g. v0.1.0"
|
||||
required: true
|
||||
type: string
|
||||
prerelease:
|
||||
description: "Mark this release as a pre-release"
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build ${{ matrix.asset }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
bin: drmlibre.exe
|
||||
asset: drmlibre-windows-x86_64.exe
|
||||
- os: macos-latest
|
||||
target: aarch64-apple-darwin
|
||||
bin: drmlibre
|
||||
asset: drmlibre-macos-aarch64
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
bin: drmlibre
|
||||
asset: drmlibre-macos-x86_64
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Cache cargo build
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
- name: Build release binary
|
||||
run: cargo build --release --locked --target ${{ matrix.target }} --bin drmlibre
|
||||
|
||||
- name: Stage artifact
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p dist
|
||||
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "dist/${{ matrix.asset }}"
|
||||
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.asset }}
|
||||
path: dist/${{ matrix.asset }}
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
name: Publish GitHub Release
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: dist
|
||||
merge-multiple: true
|
||||
|
||||
- name: Publish to GitHub Releases
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ inputs.tag }}
|
||||
name: ${{ inputs.tag }}
|
||||
prerelease: ${{ inputs.prerelease }}
|
||||
generate_release_notes: true
|
||||
fail_on_unmatched_files: true
|
||||
files: dist/*
|
||||
Reference in New Issue
Block a user