Trigger GitHub push/deploy actions on new tags #2
This file contains 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: 'Bump Version' | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
bump-version: | |
name: 'Bump version on main branch' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Git repository | |
uses: 'actions/checkout@v3' | |
with: | |
ref: ${{ github.ref }} | |
- name: Read package.json | |
run: cat ./package.json | |
- name: Automated Version Bump | |
id: version-bump | |
uses: 'phips28/gh-action-bump-version@master' | |
with: | |
tag-prefix: 'v' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Read package.json | |
run: cat ./package.json | |
- name: Output Step | |
env: | |
NEW_TAG: ${{ steps.version-bump.outputs.newTag }} | |
run: echo "new tag $NEW_TAG" | |
# Workflow: | |
# | |
# 1. Based on the commit messages, increment the version from the latest release. | |
# * If the string "BREAKING CHANGE", "major" or the Attention pattern | |
# `refactor!: drop support for Node 6` is found anywhere in any of the commit messages or | |
# descriptions the major version will be incremented. | |
# * If a commit message begins with the string "feat" or includes "minor" then the minor version | |
# will be increased. This works for most common commit metadata for feature additions: "feat: | |
# new API" and "feature: new API". | |
# * If a commit message contains the word "pre-alpha" or "pre-beta" or "pre-rc" then the | |
# pre-release version will be increased (for example specifying pre-alpha: 1.6.0-alpha.1 -> | |
# 1.6.0-alpha.2 or, specifying pre-beta: 1.6.0-alpha.1 -> 1.6.0-beta.0) | |
# * All other changes will increment the patch version. | |
# | |
# 2. Push the bumped npm version in package.json back into the repo. | |
# | |
# 3. Push a tag for the new version back into the repo. |