name: Release
on:
push:
tags:
- 'v[0-9]*.[0-9]*.[0-9]*'
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run mode (skip actual publishing)'
required: false
default: true
type: boolean
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_HTTP_MULTIPLEXING: "false"
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
- name: Verify Cargo.lock is up to date
run: cargo check --locked
- name: Run tests
run: make test
publish-crates:
name: Publish to crates.io
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
if: ${{ inputs.dry_run != true }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p switchkit --locked
- name: Test crates.io publish (dry run)
if: ${{ inputs.dry_run == true }}
run: cargo publish -p switchkit --dry-run --locked
github-release:
name: Create GitHub release
needs: publish-crates
if: ${{ inputs.dry_run != true }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true