Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Release

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:

permissions:
contents: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: macos-14
target: x86_64-apple-darwin
- os: macos-14
target: aarch64-apple-darwin
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
persist-credentials: false

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Install cross-compilation toolchain
if: runner.os == 'Linux'
uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}

- name: Cache Cargo dependencies
uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}

- name: Build release binary
run: cargo build --release --bin qmtacp --target ${{ matrix.target }}

- name: Package archive
run: |
PKG="qmtacp-${{ github.ref_name }}-${{ matrix.target }}"
STAGING="dist/${PKG}"
mkdir -p "$STAGING"
cp "target/${{ matrix.target }}/release/qmtacp" "$STAGING/"
cp README.md LICENSE "$STAGING/"
tar -czf "dist/${PKG}.tar.gz" -C dist "$PKG"
echo "ASSET_PATH=dist/${PKG}.tar.gz" >> "$GITHUB_ENV"

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: qmtacp-${{ matrix.target }}
path: ${{ env.ASSET_PATH }}

release:
name: GitHub Release
needs: [build]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/
pattern: 'qmtacp-*'
merge-multiple: true

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
draft: ${{ github.ref_type != 'tag' }}
prerelease: ${{ github.ref_type != 'tag' }}
Loading