95 lines
2.8 KiB
YAML
95 lines
2.8 KiB
YAML
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
|
|
- name: Install Rust toolchain
|
|
# dtolnay/rust-toolchain has no tagged releases; pinned to master @ 2026-06-20.
|
|
# When pinned to a SHA the channel must be given explicitly via `toolchain`.
|
|
uses: dtolnay/rust-toolchain@67ef31d5b988238dd797d409d6f9574278e20537
|
|
with:
|
|
toolchain: "1.96.0" # latest stable as of 2026-06-24
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Cache cargo build
|
|
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
|
|
|
|
- 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
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@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- name: Publish to GitHub Releases
|
|
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
|
|
with:
|
|
tag_name: ${{ inputs.tag }}
|
|
name: ${{ inputs.tag }}
|
|
prerelease: ${{ inputs.prerelease }}
|
|
generate_release_notes: true
|
|
fail_on_unmatched_files: true
|
|
files: dist/*
|