name: Release
permissions:
contents: write
id-token: write
on:
workflow_dispatch:
inputs:
version:
type: string
required: false
description: Version Number
jobs:
publish:
name: Release new version (${{ github.event.inputs.version }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: rust-lang/crates-io-auth-action@v1
id: auth
- uses: dtolnay/rust-toolchain@stable
- name: Update version and push changes
if: ${{ github.event.inputs.version }}
run: |
sed -i "s/^version = \".*\"/version = \"${{ github.event.inputs.version }}\"/" Cargo.toml
cargo update
git config --global user.name "GitHub Action"
git config --global user.email "username@users.noreply.github.com"
git commit -a -m "publish: ${{ github.event.inputs.version }}"
git push
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}