Skip to content

chore: bump cargo-mono to 0.6.8 (#391) #8

chore: bump cargo-mono to 0.6.8 (#391)

chore: bump cargo-mono to 0.6.8 (#391) #8

name: Release cargo-mono
on:
push:
tags:
- "cargo-mono@v*"
workflow_dispatch:
inputs:
version:
description: "Semver without v prefix (for example: 0.2.0)"
required: true
dry_run:
description: "If true, skip GitHub release publication"
required: false
default: "true"
type: choice
options:
- "true"
- "false"
permissions:
contents: write
id-token: write
concurrency:
group: release-cargo-mono-${{ github.ref }}
cancel-in-progress: false
jobs:
prepare:
name: Prepare metadata
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.meta.outputs.tag }}
version: ${{ steps.meta.outputs.version }}
dry_run: ${{ steps.meta.outputs.dry_run }}
steps:
- name: Resolve release metadata
id: meta
shell: bash
run: |
set -euo pipefail
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
tag="cargo-mono@v${{ github.event.inputs.version }}"
dry_run="${{ github.event.inputs.dry_run }}"
else
tag="${GITHUB_REF_NAME}"
dry_run="false"
fi
version="${tag#cargo-mono@v}"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "dry_run=$dry_run" >> "$GITHUB_OUTPUT"
build:
name: Build (${{ matrix.asset_os }}-${{ matrix.asset_arch }})
runs-on: ${{ matrix.os }}
needs: prepare
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
asset_os: linux
asset_arch: amd64
archive_ext: tar.gz
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
asset_os: linux
asset_arch: arm64
archive_ext: tar.gz
- os: macos-15-intel
target: x86_64-apple-darwin
asset_os: darwin
asset_arch: amd64
archive_ext: tar.gz
- os: macos-14
target: aarch64-apple-darwin
asset_os: darwin
asset_arch: arm64
archive_ext: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
asset_os: windows
asset_arch: amd64
archive_ext: zip
- os: windows-11-arm
target: aarch64-pc-windows-msvc
asset_os: windows
asset_arch: arm64
archive_ext: zip
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly-2026-01-01
target: ${{ matrix.target }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Build cargo-mono
shell: bash
run: |
set -euo pipefail
cargo build -p cargo-mono --release --target "${{ matrix.target }}"
- name: Package artifact
shell: bash
run: |
set -euo pipefail
mkdir -p dist
artifact_name="cargo-mono-${{ matrix.asset_os }}-${{ matrix.asset_arch }}.${{ matrix.archive_ext }}"
if [ "${{ matrix.asset_os }}" = "windows" ]; then
cp "target/${{ matrix.target }}/release/cargo-mono.exe" dist/cargo-mono.exe
pwsh -NoLogo -NoProfile -Command "Compress-Archive -Path dist/cargo-mono.exe -DestinationPath dist/${artifact_name}"
rm -f dist/cargo-mono.exe
else
cp "target/${{ matrix.target }}/release/cargo-mono" dist/cargo-mono
tar -C dist -czf "dist/${artifact_name}" cargo-mono
fi
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: cargo-mono-${{ matrix.asset_os }}-${{ matrix.asset_arch }}
path: dist/*
publish:
name: Publish release
runs-on: ubuntu-latest
needs:
- prepare
- build
env:
RELEASE_TAG: ${{ needs.prepare.outputs.tag }}
DRY_RUN: ${{ needs.prepare.outputs.dry_run }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist
- name: Flatten artifact directory
shell: bash
run: |
set -euo pipefail
mkdir -p release-dist
find dist -maxdepth 2 -type f -exec cp "{}" "release-dist/" \;
rm -rf dist
mv release-dist dist
find dist -maxdepth 1 -type f | sed 's#^#artifact: #' >&2
- name: Install cosign
uses: sigstore/cosign-installer@v4.1.1
- name: Generate checksums and signatures
shell: bash
run: |
set -euo pipefail
chmod +x ./scripts/release/generate-checksums.sh
./scripts/release/generate-checksums.sh --artifacts-dir dist
- name: Create GitHub release
if: env.DRY_RUN != 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.RELEASE_TAG }}
files: dist/*
generate_release_notes: true