Skip to content

Bump Version

Bump Version #21

Workflow file for this run

name: Bump Version
on:
push:
branches:
- 'main'
paths-ignore:
- 'package.json'
- 'Cargo.toml'
workflow_dispatch:
inputs:
release_type:
type: choice
description: Release type
options:
- major
- minor
- patch
jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check input
id: input
run: |
if [[ -z "${{ github.event.inputs.release_type }}" ]]; then
echo "release_type=patch" >> $GITHUB_OUTPUT
else
echo "release_type=${{ github.event.inputs.release_type }}" >> $GITHUB_OUTPUT
fi
- name: cargo-bump cache
uses: actions/cache@v4
id: cargo-bump
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-bump
- if: steps.cargo-bump.outputs.cache-hit != 'true'
run: cargo install cargo-bump
- name: Bump Cargo.toml version
run: cargo bump ${{ steps.input.outputs.release_type }}
- name: Bump package.json version
id: npm
run: echo "new_version=$(npm version --commit-hooks false --git-tag-version false ${{ steps.input.outputs.release_type }})" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.PAT }}
commit-message: Bump version to ${{ steps.npm.outputs.new_version }}
title: "Bump version to ${{ steps.npm.outputs.new_version }}"
branch: "chore/bump-to-${{ steps.npm.outputs.new_version }}"
body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/main...chore/bump-to-${{ steps.npm.outputs.new_version }})"
labels: version
assignees: wilzet