https://github.com/cssnr/update-version-tags-action
Update Version Tags Automatically
https://github.com/cssnr/update-version-tags-action
actions
Last synced: 5 months ago
JSON representation
Update Version Tags Automatically
- Host: GitHub
- URL: https://github.com/cssnr/update-version-tags-action
- Owner: cssnr
- License: gpl-3.0
- Created: 2024-06-06T09:45:06.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-21T23:22:52.000Z (5 months ago)
- Last Synced: 2025-02-21T23:45:19.311Z (5 months ago)
- Topics: actions
- Language: JavaScript
- Homepage: https://cssnr.github.io
- Size: 80.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/cssnr/update-version-tags-action/actions/workflows/release.yaml)
[](https://github.com/cssnr/update-version-tags-action/actions/workflows/test.yaml)
[](https://sonarcloud.io/summary/new_code?id=cssnr_update-version-tags-action)
[](https://github.com/cssnr/update-version-tags-action/releases/latest)
[](https://github.com/cssnr/update-version-tags-action/graphs/commit-activity)
[](https://codeberg.org/cssnr/update-version-tags-action)
[](https://github.com/cssnr/update-version-tags-action)
[](https://cssnr.github.io/)
[](https://discord.gg/wXy6m2X8wY)# Update Version Tags Action
- [Inputs](#Inputs)
- [Permissions](#Permissions)
- [Outputs](#Outputs)
- [Examples](#Examples)
- [Rolling Back](#rolling-back)
- [Support](#Support)
- [Contributing](#Contributing)Update Version Tags on Push or Release for Semantic Versions or Custom Tags.
Automatically maintain both Major `1.x.x` and/or Minor `1.1.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 `v1` and `v1.x` tags that points to the latest release of the `v1.x.x` branch.For GitHub Actions, you can copy and paste this workflow: [release.yaml](.github/workflows/release.yaml)
> [!NOTE]
> Please submit
> a [Feature Request](https://github.com/cssnr/update-version-tags-action/discussions/categories/feature-requests)
> for new features or [Open an Issue](https://github.com/cssnr/update-version-tags-action/issues) if you find any bugs.## Inputs
| 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** - The target tag the `sha` is parsed from. Defaults to the tag 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.
If you plan on rolling back you need to use a PAT. See [Rolling Back](#rolling-back).**summary** - Write a Summary for the job. To disable this set to `false`.
📜 View Example Job Summary
---
Tag
v1.0.1
Sha9b5d1797561610366c63dcd48b0764f4cdd91761
Tagsv1,v1.0
TagsResultsTagResultv1
v1.0v1
Updatedv1.0
UpdatedSemVer```json
{
"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](#rolling-back) for more information and an example.For semantic versions, simply add this step to your release workflow:
```yaml
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
```### Permissions
This action requires the following permissions:
```yaml
permissions:
contents: write
```## Outputs
| output | description |
| ------ | ------------------------------------- |
| tags | Comma Seperated String of Parsed Tags |Example output:
```text
v1,v1.0
```Using the outputs:
```yaml
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
id: tags- name: 'Echo Tags'
run: echo ${{ steps.tags.outputs.tags }}
```## Examples
This is the workflow used by this Action to update tags on release: [release.yaml](.github/workflows/release.yaml)
```yaml
name: 'Release'on:
release:
types: [published]jobs:
release:
name: 'Release'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: writesteps:
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
```Specifying the tags to update or create:
```yaml
- 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:
```yaml
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
with:
tag: v1.0.1
```### Rolling Back
To rollback tags you must use a PAT with the `repo` permission.
The target `sha` will be parsed from the target `tag` provided in the UI.This is the workflow used by this Action to roll back tags: [tags.yaml](.github/workflows/tags.yaml)
```yaml
name: 'Tags'on:
workflow_dispatch:
inputs:
tag:
description: 'Target Tag'
required: truejobs:
tags:
name: 'Tags'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: writesteps:
- name: 'Update Tags'
uses: cssnr/update-version-tags-action@v1
with:
tag: ${{ inputs.tag }}
token: ${{ secrets.GH_PAT }}
```# Support
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-requestsIf 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/](https://cssnr.github.io/feedback/?app=Update%20Version%20Tags)# Contributing
Currently, the best way to contribute to this project is to star this project on GitHub.
Additionally, you can support other GitHub Actions I have published:
- [Stack Deploy Action](https://github.com/cssnr/stack-deploy-action?tab=readme-ov-file#readme)
- [Portainer Stack Deploy](https://github.com/cssnr/portainer-stack-deploy-action?tab=readme-ov-file#readme)
- [VirusTotal Action](https://github.com/cssnr/virustotal-action?tab=readme-ov-file#readme)
- [Mirror Repository Action](https://github.com/cssnr/mirror-repository-action?tab=readme-ov-file#readme)
- [Update Version Tags Action](https://github.com/cssnr/update-version-tags-action?tab=readme-ov-file#readme)
- [Update JSON Value Action](https://github.com/cssnr/update-json-value-action?tab=readme-ov-file#readme)
- [Parse Issue Form Action](https://github.com/cssnr/parse-issue-form-action?tab=readme-ov-file#readme)
- [Cloudflare Purge Cache Action](https://github.com/cssnr/cloudflare-purge-cache-action?tab=readme-ov-file#readme)
- [Mozilla Addon Update Action](https://github.com/cssnr/mozilla-addon-update-action?tab=readme-ov-file#readme)
- [Docker Tags Action](https://github.com/cssnr/docker-tags-action?tab=readme-ov-file#readme)For a full list of current projects to support visit: [https://cssnr.github.io/](https://cssnr.github.io/)