GitHub Action
Automated Version Bump for AsyncAPI
NOTICE: This library is at it's core forked from GH action bump npm version.
GitHub action used to bump the AsyncAPI document version in similar fashion to semantic-release.
It analyses the commit messages to figure out how to appropriately bump the AsyncAPI document version while following semver.
Attention
- Make sure you use the
actions/checkout@v2
action before this, otherwise the GH action do not have access to the AsyncAPI document! - Currently only JSON format are supported and not YAML.
The GitHub action support different outputs that can be used in other jobs to control or modify workflows.
Makes it possible to run conditional extra jobs depending on whether the AsyncAPI document version was bumped or not.
- name: 'Automated Version Bump'
id: version_bump
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- if: steps.version_bump.outputs.wasBumped == 'true'
name: This job is only run if the AsyncAPI document was bumped.
Access the old version of the AsyncAPI document before the version was bumped.
- name: 'Automated Version Bump'
id: version_bump
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- if: steps.version_bump.outputs.wasBumped == 'true'
name: Print the old version of the document
run: |
echo ${{steps.version_bump.outputs.oldVersion}}
Access the new version of the AsyncAPI document after the version was bumped.
- name: 'Automated Version Bump'
id: version_bump
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- if: steps.version_bump.outputs.wasBumped == 'true'
name: Print the new version of the document
run: |
echo ${{steps.version_bump.outputs.newVersion}}
Customize the messages that triggers which version bump. It must be a string, case sensitive and comma separated (optional). Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
minor-wording: 'add,Adds,new'
major-wording: 'MAJOR,cut-major'
patch-wording: 'patch,fixes' # Providing patch-wording will override commits
# defaulting to a patch bump.
release-candidate-wording: 'RELEASE,alpha'
Set a pre-id value will building prerelease version (optional - defaults to 'rc'). Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
default: prerelease
pre-id: 'prc'
Prefix that is used for the git tag (optional). Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag-prefix: 'v'
The tag is not added to the git repository (optional). Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
skip-tag: 'true'
No commit is made after the version is bumped (optional). Must be used in combination with skip-tag
, since if there's no commit, there's nothing to tag. Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
skip-commit: 'true'
skip-tag: 'true'
If true, skip pushing any commits or tags created after the version bump (optional). Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
skip-push: 'true'
Set a custom path to the asyncapi document. Useful in cases such as updating the version on main after a tag has been set (optional). Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path-to-asyncapi: './asyncapi.json'
Set a custom target branch to use when bumping the version. Useful in cases such as updating the version on main after a tag has been set (optional). Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target-branch: 'main'
Set a custom pre-release id. Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
pre-release-id: 'next'
Set a custom commit message for version bump commit. Useful for skipping additional workflows run on push. Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit-message: 'CI: bumps version to {{version}} [skip ci]'
This makes sure that no changes are made to the AsyncAPI document and no changes are committed. Use this to determine if any bumps is necessary (optional). Example:
- name: 'Automated Version Bump'
uses: 'jonaslagoni/gh-action-asyncapi-document-bump@main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
dry-run: 'true'