Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

Automated Version Bump for AsyncAPI

v0.4.2

Automated Version Bump for AsyncAPI

play

Automated Version Bump for AsyncAPI

Automated version bump for AsyncAPI documents to follow Semantic Versioning

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Automated Version Bump for AsyncAPI

uses: jonaslagoni/gh-action-asyncapi-document-bump@v0.4.2

Learn more about this action in jonaslagoni/gh-action-asyncapi-document-bump

Choose a version

NOTICE: This library is at it's core forked from GH action bump npm version.

AsyncAPI sematic release

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.

Outputs

The GitHub action support different outputs that can be used in other jobs to control or modify workflows.

wasBumped:

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.

oldVersion:

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

newVersion:

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

Customization

wording:

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'

pre-id:

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'

tag-prefix:

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'

skip-tag:

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'

skip-commit:

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'

skip-push:

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'

path-to-asyncapi:

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'

target-branch:

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'

pre-release-id:

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'

commit-message:

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]'

dry-run:

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'