Tag 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
| name: Tag Version | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| releaseType: | |
| description: 'Semver Release Type (major,minor,patch)' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| jobs: | |
| tag: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Validate releaseType | |
| run: pnpx in-string-list ${{ github.event.inputs.releaseType }} major,minor,patch | |
| - name: Setup Git | |
| run: | | |
| git config user.name Jon Johnson | |
| git config user.email jon.johnson@ucsf.edu | |
| - name: Increment Package Versions | |
| run: | | |
| pnpx versionup --level ${{ github.event.inputs.releaseType }} | |
| - run: | | |
| NEW_TAG=`node -p "require('./package.json').version"` | |
| echo ${NEW_TAG} | |
| echo "new_tag=${NEW_TAG}" >> $GITHUB_ENV | |
| - name: Tag Version | |
| run: | | |
| git add package.json | |
| git commit -m "${{env.new_tag}}" | |
| git tag v${{env.new_tag}} -m "Tagging the v${{env.new_tag}} ${{ github.event.inputs.releaseType }} release" | |
| - name: Push Changes | |
| run: git push --follow-tags |