cli/.github/workflows/create-release.yml

63 lines
1.8 KiB
YAML

name: Create Release
on:
workflow_dispatch:
inputs:
bump:
description: "Version bump type"
required: true
type: choice
options:
- patch
- minor
- major
# Prevent concurrent releases
concurrency:
group: release
cancel-in-progress: false
jobs:
create-release:
name: Bump Version & Publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-release
run: cargo install cargo-release
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version and create tag
id: bump
run: |
# Get current version
CURRENT_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
echo "Current version: $CURRENT_VERSION"
# Run cargo release (bumps version, updates package.json, commits, tags)
cargo release ${{ inputs.bump }} --no-publish --no-push --no-confirm --execute
# Get new version
NEW_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
echo "New version: $NEW_VERSION"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
# Publishing (crates.io, npm, binaries) is handled by release.yml
# which triggers on the tag push below
- name: Push changes and tag
run: |
git pull --rebase origin master
git push origin master
git push origin "v${{ steps.bump.outputs.version }}"