π Bump Version #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# trunk-ignore-all(checkov/CKV_GHA_7): workflow_dispatch must be configurable | |
name: π Bump Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version_type: | |
description: Type of version bump | |
required: true | |
type: choice | |
options: | |
- auto | |
- major | |
- minor | |
- patch | |
permissions: | |
contents: write | |
jobs: | |
bump-version: | |
name: π Bump ${{ github.event.inputs.version_type }} version | |
runs-on: ubuntu-latest | |
steps: | |
- name: β¬οΈ Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- name: ποΈ Setup Node.js | |
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
with: | |
node-version: 20 | |
- name: π Bump version with Nyx | |
if: github.event.inputs.version_type == 'auto' | |
id: nyx | |
uses: mooltiverse/nyx@main | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
command: infer | |
preset: extended | |
releaseLenient: true | |
- name: π Update package.json | |
if: github.event.inputs.version_type == 'auto' | |
run: | | |
npm version ${{ steps.nyx.outputs.version }} --no-git-tag-version | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add package.json | |
git commit -m "π: bump version to ${{ steps.nyx.outputs.version }}" | |
git push origin main | |
- name: π Manual version bump | |
if: github.event.inputs.version_type != 'auto' | |
run: | | |
npm version ${{ github.event.inputs.version_type }} --no-git-tag-version | |
VERSION=$(node -p "require('./package.json').version") | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add package.json | |
git commit -m "π: bump ${{ github.event.inputs.version_type }} version to ${VERSION}" | |
git push origin main |