GitHub action that updates tags in a repository (still in development). Uses the semantic versioning to update the tags.
type: The type of version update. The value can be patch, minor, or major. The default value is patch.version: The specific version to update. The value can be any valid version string.skip-push: A flag to skip pushing the changes to the remote repository. The value can be true or false. The default value is false. Mainly used for local development.
version: The updated version.previous-version: The previous version.
name: Update Tags
on:
workflow_dispatch:
inputs:
version:
description: 'specific version'
required: false
type: string
update-type:
description: 'version update type'
required: false
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update tags
uses: rczajkadev/update-tags@main # note that it's still in development, the version will be updated later (e.g. rczajkadev/update-tags@v1)
with:
type: ${{ github.event.inputs.update-type }}
version: ${{ github.event.inputs.version }}The following examples show how to use the action in different scenarios.
User scenario: As an action user, I want to update the patch version of a repository to create a new release. The current version is 1.2.3.
Solution: Set the type input to patch and run the action.
Result: The version is updated to 1.2.4. The following tags are created or updated to point to the latest version:
1.2.41.21latest
User scenario: As an action user, I want to update the minor version of a repository to create a new release. The current version is v2.3.4.
Solution: Set the type input to minor and run the action.
Result: The version is updated to v2.4.0. The following tags are created or updated to point to the latest version:
v2.4.0v2.4v2latest
User scenario: As an action user, I want to update the major version of a repository to create a new release. The current version is v1.2.3.
Solution: Set the type input to major and run the action.
Result: The version is updated to v2.0.0. The following tags are created or updated to point to the latest version:
v2.0.0v2.0v2latest
User scenario: As an action user, I want to create a pre-release vestion v1.2.3-alpha.1.
Solution: Set the version input to v1.2.3-alpha.1 and run the action.
Result: The version is updated to v1.2.3-alpha.1. Only the v1.2.3-alpha.1 tag is created.
-
When incrementing version using the
typeinput, the latest full version, non pre-release, is used as a base. For example, even if the current version isv1.2.0-alpha.1, theminortype will increment the latestv1.1.23version tov1.2.0. -
The
vprefix can be used, but it's not required. Both1.2.3andv1.2.3are valid version strings. -
When creating a development version, e.g. an initial
v0.1.0, thev0tag is omitted (v0.1.0,v0.1, andlatestare created as usual). Similarly, when creating av0.0.x(e.g.v0.0.1), thev0andv0.0tags are omitted.
- Clone the repository
- Install the dependencies using
npm install - Run the
npm run preparecommand to set up the environment - Set input values in the
.env.devfile - Run the action using
npm run dev
GPL-3.0 - see the LICENSE file for details.