Update Version Tags on Push or Release for Semantic Versions or Custom Tags.
Zero configuration to maintain both major vN
-> vN.x.x
and minor vN.N
-> vN.N.x
tags.
This is useful if you want to automatically update additional tags, to point to your pushed/released tag.
For example, many GitHub Actions maintain a vN
and vN.N
tag that points to the latest release of the vN.x.x
branch.
GitHub Actions can copy and paste this workflow: release.yaml
Note
Please submit a Feature Request for new features or Open an Issue if you find any bugs.
For more details see action.yml and src/index.js.
Input | Required | Default | Description |
---|---|---|---|
prefix | - | v |
Tag Prefix for Semantic Versions |
major | - | true |
Update Major Tag * |
minor | - | true |
Update Minor Tag * |
tags | - | - | Additional Tags to Update * |
tag | - | github.ref_name |
Manually Set Target Tag ** |
summary | - | true |
Add Summary to Job * |
dry_run | - | false |
Do not create tags, outout only |
token | - | github.token |
For use with a PAT to rollback * |
major/minor - Both major and minor versions are parsed from the release tag using semver
. If you release
version 1.0.0
this will update or create a reference for v1
and v1.0
. If you are not using semantic versions, set
both to false
and provide your own tags
.
tags - The prefix
is not applied to specified tags. These can be a string list "v1,v1.0"
or newline
delimited |
. If you only want to update the specified tags
make sure to set both major
and minor
to false
.
tag - This is the target tag to parse the sha
from. Defaults to the sha
that triggered the workflow.
To override this behavior you can specify a target tag here from which the target sha
will be parsed.
This is the sha
that all parsed or provided tags
are updated too. Rolling back requires a PAT.
See Rolling Back for more details and a manual workflow example.
summary - Write a Summary for the job. To disable this set to false
.
π View Example Job Summary
Tag | v1.0.1 |
Sha | 9b5d1797561610366c63dcd48b0764f4cdd91761 |
Tags | v1,v1.0 |
Tags
v1
v1.0
Results
Tag | Result |
---|---|
v1 | Updated |
v1.0 | Updated |
SemVer
{
"options": {},
"loose": false,
"includePrerelease": false,
"raw": "v1.0.1",
"major": 1,
"minor": 0,
"patch": 1,
"prerelease": [],
"build": [],
"version": "1.0.1"
}
Inputs
prefix: v
major: true
minor: true
tags: ""
tag: ""
summary: true
dry_run: false
token - GitHub workflow tokens do not allow for rolling back or deleting tags.
To do this you must create a PAT with the repo
and workflow
permissions, add it to secrets, and use it.
See Rolling Back for more information and an example.
For semantic versions, simply add this step to your release workflow:
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
This action requires the following permissions:
permissions:
contents: write
Permissions documentation for Workflows and Actions.
Output | Description |
---|---|
tags | Comma Seperated String of Parsed Tags |
Example output:
v1,v1.0
Using the outputs:
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
id: tags
- name: 'Echo Tags'
run: echo ${{ steps.tags.outputs.tags }}
This is the workflow used by this Action to update tags on release: release.yaml
name: 'Release'
on:
release:
types: [published]
jobs:
release:
name: 'Release'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
Specifying the tags to update or create:
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
with:
major: false
minor: false
tags: |
v1
v1.0
Specifying the target tag to update too:
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
with:
tag: v1.0.1
To roll back or manually update tags, copy this workflow: tags.yaml
To rollback tags you must use a PAT with the repo
and workflow
permissions.
The target sha
will be parsed from the target tag
provided in the UI.
For example, if you releases v1.0.1
but wanted to roll back to v1.0.0
.
You would run the workflow with tag v1.0.0
it would update the v1
and v1.0
tags
(or what ever tags you manually specify) to point back to the sha of tag v1.0.0
.
This same workflow could be used to manually roll forward without a PAT.
name: 'Tags'
on:
workflow_dispatch:
inputs:
tag:
description: 'Target Tag'
required: true
jobs:
tags:
name: 'Tags'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write
steps:
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
with:
tag: ${{ inputs.tag }}
token: ${{ secrets.GH_PAT }}
The following rolling tags are maintained.
You can view the release notes for each version on the releases page.
You can use shields.io to generate dynamic badges that always point to the latest tags for semantic versions.
Tag badges can be created here: https://shields.io/badges/git-hub-tag
Set sort to semver
and filter to one of the following.
Version | filter | Example | Example | Example | Example |
---|---|---|---|---|---|
Major | !v*.* |
||||
Minor | !v*.*.* |
||||
Micro |
You may need to adjust the filter to match your tagging scheme.
To create a 2 color badge with icon and no text; set a labelColor
with an empty label
.
GitHub's media proxy caches images for 1 hour. You can purge the cache by sending a PURGE
request.
curl -X PURGE 'https://camo.githubusercontent.com/xxx'
For general help or to request a feature, see:
- Q&A Discussion: https://github.com/cssnr/update-version-tags-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/update-version-tags-action/discussions/categories/feature-requests
If you are experiencing an issue/bug or getting unexpected results, you can:
- Report an Issue: https://github.com/cssnr/update-version-tags-action/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General Feedback: https://cssnr.github.io/feedback/
For more information, see the CSSNR SUPPORT.md.
Currently, the best way to contribute to this project is to star this project on GitHub.
For more information, see the CSSNR CONTRIBUTING.md.
Additionally, you can support other GitHub Actions I have published:
- Stack Deploy Action
- Portainer Stack Deploy
- VirusTotal Action
- Mirror Repository Action
- Update Version Tags Action
- Update JSON Value Action
- Parse Issue Form Action
- Cloudflare Purge Cache Action
- Mozilla Addon Update Action
- Docker Tags Action
For a full list of current projects to support visit: https://cssnr.github.io/