Skip to content

πŸš€ Bump Version #2

πŸš€ Bump Version

πŸš€ Bump Version #2

---
# 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