Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joutvhu/create-tag
GitHub Action to create tag
https://github.com/joutvhu/create-tag
actions create github github-actions tag update
Last synced: 7 days ago
JSON representation
GitHub Action to create tag
- Host: GitHub
- URL: https://github.com/joutvhu/create-tag
- Owner: joutvhu
- License: mit
- Created: 2023-02-05T04:04:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-03T17:01:09.000Z (6 months ago)
- Last Synced: 2024-10-14T09:42:28.524Z (about 1 month ago)
- Topics: actions, create, github, github-actions, tag, update
- Language: JavaScript
- Homepage:
- Size: 1.01 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Create Tag
GitHub Action to create or update tag.
Useful when you want to create/update major version tag every time there is a release.
It works well with [GitHub Action versioning](https://docs.github.com/en/actions/creating-actions/about-custom-actions#using-tags-for-release-management).## Usage
See [action.yml](action.yml)
### Inputs
For more information on these inputs, see the [API Documentation](https://developer.github.com/v3/git/tags/#input)
- `owner`: The name of the owner of the repo. Used to identify the owner of the repository. Default: Current owner
- `repo`: The name of the repository. Default: Current repository
- `tag_name`: The name of the tag.
- `tag_sha`: The SHA of the git object this is tagging.
- `type`: The type of the object we're tagging. Normally this is a `commit` but it can also be a `tree` or a `blob`.
- `message`: The tag message.
- `on_tag_exists`: Indicate what to do if the tag_name already exists. Options: `skip`, `update`, `warn`, `error`. Default `skip`.### Outputs
- `tag_name`: The name of the tag.
- `tag_sha`: The SHA of the git object this is tagging.### Example
The following example is used to create or update the major version tag every time a new release is available.
```yaml
name: Create Major Version Tagon:
release:
types: [released]jobs:
tagging:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get current release
id: current_release
uses: joutvhu/get-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}# Get major version: (Ex: `v1.0.0` -> `v1`)
- name: Get major version from release
id: major_version
run: |
echo "::set-output name=version::$(echo ${{ steps.current_release.outputs.tag_name }} | cut -f 1 -d .)"# Create or update major version tag (Ex: v1, v2, ...)
- name: Create or update major version
uses: joutvhu/create-tag@v1
with:
tag_name: ${{ steps.major_version.outputs.version }}
message: ${{ steps.current_release.outputs.name }}
on_tag_exists: update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```