Version Bump #6
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
| name: Version Bump | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version bump type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| message: | |
| description: 'Commit message (will be appended after ✂️ version)' | |
| required: false | |
| default: '' | |
| type: string | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| bump: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| - 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 | |
| run: npm version ${{ inputs.version }} --no-git-tag-version | |
| - name: Commit and tag | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| git add package.json package-lock.json | |
| MESSAGE="${{ inputs.message }}" | |
| if [ -n "$MESSAGE" ]; then | |
| git commit -m "✂️ $VERSION - $MESSAGE" | |
| else | |
| git commit -m "✂️ $VERSION" | |
| fi | |
| git tag "v$VERSION" | |
| - name: Push changes | |
| run: git push --follow-tags | |
| publish: | |
| needs: bump | |
| uses: ./.github/workflows/main.yml | |
| secrets: inherit |