From 01137a8d2c4387551b97e313b7e918f348694302 Mon Sep 17 00:00:00 2001 From: Ivan Zatevakhin Date: Wed, 16 Sep 2026 14:06:46 +0100 Subject: [PATCH] feat: add GitHub Release CI for linux musl and darwin Build qmtacp on tag v*.*.* for x86_64/aarch64 linux-musl and x86_64/aarch64 darwin, package tar.gz archives, and publish a GitHub Release. workflow_dispatch creates a draft. --- .github/workflows/release.yml | 96 +++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a57b245 --- /dev/null +++ b/.github/workflows/release.yml @@ -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' }}