Skip to content

Latest commit

 

History

History
75 lines (58 loc) · 4.17 KB

README.md

File metadata and controls

75 lines (58 loc) · 4.17 KB

update-project-version

GitHub action to automatically update project version and create version tag.

Prerequisites

GNU Bash Git

Current version in the project and use semantic versioning as well as conventional commits.

Breaking changes increase the major version, feats increase the minor, and fixes increase the patch version. The rest of the commit types increase the patch by default but can be configured to increase the minor version.

Usage

Add a step to your GitHub workflow using the action. For example:

name: my-workflow

run-name: Do stuff + update version

on:
  push:
    branches:
      - '**'

jobs:
  do_stuff:
    runs-on: ubuntu-latest
    name: Do stuff
    steps:
      - id: echo_stuff
        name: Echo stuff
        run: echo "Doing stuff"
        shell: bash
  update_version:
    if: ${{ github.ref == 'refs/heads/develop' }}
    needs: do_stuff
    runs-on: ubuntu-latest
    name: Update project version
    steps:
      - id: new_version
        uses: nomasystems/update-project-version@latest
        with:
          tag-prefix: "v"
          version-files: "File1,File2,File3"

The action accepts the following inputs:

Input param Required Default value Description
committer-email ✖️ 'github-actions[bot]@users.noreply.github.com' Committer e-mail
committer-username ✖️ 'github-actions[bot]' Committer username
extra-minor-commit-types ✖️ '' Extra commit types for minor changes (comma separated list)
extra-patch-commit-types ✖️ 'build,chore,ci,docs,perf,refactor,style,test' Extra commit types for patch changes (comma separated list)
latest-tag ✖️ 'false' Indicates if an extra tag "latest" should be added
tag-preffix ✖️ '' Git tag prefix (tag chars before the version chars)
tag-suffix ✖️ '' Git tag suffix (tag chars after the version chars)
version-files ✖️ '' Files to update with the new version (comma separated list)

⚠️ In order to work properly, the repository must have a "current version" given by:

  • Initial tag, from which the action will obtain the current version number
  • Current version number in the specified "version-files", which the action will update with the new version

⚠️ In order to work properly, the project must use conventional commits with the following considerations:

  • A commit message must have the form {type}(#{issue_number}):{message}
  • A commit message starting with xxx! (being xxx any valid type/scope) or including footers BREAKING CHANGE: xxx or BREAKING-CHANGE: xxx will result in a major update (increment the 1st number in the version)
  • A commit message with types feat or any type under extra-minor-commit-types will result in a minor update (increment the 2nd number in the version)
  • A commit message with types fix or any type under extra-patch-commit-types will result in a patch update (increment the 3rd number in the version)

Contributing

Pull requests are welcome. Please read the contributing guidelines to know more about contribution.