Skip to content

Release

Release #8

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: Version without leading v, for example 1.0.0
required: true
draft:
description: Create release as draft
type: boolean
default: false
prerelease:
description: Mark release as prerelease
type: boolean
default: false
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: windows-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
bin: agent-switch.exe
asset: agent-switch-windows-x86_64.exe
- name: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
bin: agent-switch
asset: agent-switch-linux-x86_64
- name: macos-x86_64
os: macos-latest
target: x86_64-apple-darwin
bin: agent-switch
asset: agent-switch-macos-x86_64
- name: macos-aarch64
os: macos-latest
target: aarch64-apple-darwin
bin: agent-switch
asset: agent-switch-macos-aarch64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux deps
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y pkg-config libgtk-3-dev libx11-dev libxi-dev libxkbcommon-dev libwayland-dev libgl1-mesa-dev libasound2-dev
- name: Test
run: cargo test --locked
- name: Build release
run: cargo build --locked --release --target ${{ matrix.target }}
- name: Stage asset
shell: bash
run: |
mkdir -p dist
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "dist/${{ matrix.asset }}"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: dist/${{ matrix.asset }}
if-no-files-found: error
publish:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Checksums
run: cd dist && sha256sum * > SHA256SUMS.txt
- uses: softprops/action-gh-release@v2
with:
tag_name: v${{ inputs.version }}
name: AgentSwitch v${{ inputs.version }}
draft: ${{ inputs.draft }}
prerelease: ${{ inputs.prerelease }}
files: dist/*