Skip to content

chore: bump version

chore: bump version #3

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
# Build binaries for all platforms
build:
name: Build ${{ matrix.target }}${{ matrix.suffix }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
# Linux x86_64 with TUI
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
features: tui
suffix: -tui
# Linux aarch64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
cross: true
# Linux aarch64 with TUI
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
cross: true
features: tui
suffix: -tui
# macOS x86_64 (Intel)
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
# macOS x86_64 with TUI
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
features: tui
suffix: -tui
# macOS aarch64 (Apple Silicon)
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
# macOS aarch64 with TUI
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
features: tui
suffix: -tui
# Windows x86_64
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
# Windows x86_64 with TUI
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
features: tui
suffix: -tui
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross (for cross-compilation)
if: matrix.cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build binary
shell: bash
run: |
FEATURES="${{ matrix.features }}"
if [ -n "$FEATURES" ]; then
FEATURE_FLAG="--features $FEATURES"
else
FEATURE_FLAG=""
fi
if [ "${{ matrix.cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }} $FEATURE_FLAG
else
cargo build --release --target ${{ matrix.target }} $FEATURE_FLAG
fi
- name: Prepare artifacts (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
VERSION="${GITHUB_REF#refs/tags/}"
BINARY="govctl"
SUFFIX="${{ matrix.suffix }}"
ARCHIVE_NAME="govctl-${VERSION}-${{ matrix.target }}${SUFFIX}"
mkdir -p "dist/${ARCHIVE_NAME}"
cp "target/${{ matrix.target }}/release/${BINARY}" "dist/${ARCHIVE_NAME}/"
cp README.md LICENSE* "dist/${ARCHIVE_NAME}/" 2>/dev/null || true
cd dist
tar -czvf "${ARCHIVE_NAME}.tar.gz" "${ARCHIVE_NAME}"
echo "ASSET=${ARCHIVE_NAME}.tar.gz" >> $GITHUB_ENV
- name: Prepare artifacts (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$VERSION = $env:GITHUB_REF -replace 'refs/tags/', ''
$SUFFIX = "${{ matrix.suffix }}"
$ARCHIVE_NAME = "govctl-${VERSION}-${{ matrix.target }}${SUFFIX}"
New-Item -ItemType Directory -Force -Path "dist\${ARCHIVE_NAME}"
Copy-Item "target\${{ matrix.target }}\release\govctl.exe" "dist\${ARCHIVE_NAME}\"
Copy-Item README.md, LICENSE* -Destination "dist\${ARCHIVE_NAME}\" -ErrorAction SilentlyContinue
Compress-Archive -Path "dist\${ARCHIVE_NAME}" -DestinationPath "dist\${ARCHIVE_NAME}.zip"
echo "ASSET=${ARCHIVE_NAME}.zip" >> $env:GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET }}
path: dist/${{ env.ASSET }}
retention-days: 1
# Create GitHub release with all artifacts
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v7
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -la artifacts/
- name: Extract version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v2
with:
name: ${{ env.VERSION }}
draft: false
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
generate_release_notes: true
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}