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: dae-ne/update-tags@main # note that it's still in development, the version will be updated later (e.g. dae-ne/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.4
1.2
1
latest
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.0
v2.4
v2
latest
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.0
v2.0
v2
latest
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
type
input, the latest full version, non pre-release, is used as a base. For example, even if the current version isv1.2.0-alpha.1
, theminor
type will increment the latestv1.1.23
version tov1.2.0
. -
The
v
prefix can be used, but it's not required. Both1.2.3
andv1.2.3
are valid version strings. -
When creating a development version, e.g. an initial
v0.1.0
, thev0
tag is omitted (v0.1.0
,v0.1
, andlatest
are created as usual). Similarly, when creating av0.0.x
(e.g.v0.0.1
), thev0
andv0.0
tags are omitted.
- Clone the repository
- Install the dependencies using
npm install
- Run the
npm run prepare
command to set up the environment - Set input values in the
.env.dev
file - Run the action using
npm run dev
GPL-3.0 - see the LICENSE file for details.