v0.1.2 #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update tags | |
permissions: | |
contents: write | |
on: | |
release: | |
types: [published] | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Update major tag | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" | |
# vX.Y.Z | |
export TAG_NAME="${GITHUB_REF##refs/tags/}" | |
# vX | |
export VERSION_MAJOR=$(echo $TAG_NAME | grep -Eo "^v[0-9]+") | |
# Y | |
export VERSION_MINOR=$(echo $TAG_NAME | grep -Eo "[0-9]+\.[0-9]+$" | grep -Eo "^[0-9]+") | |
# vX.Y | |
export TAG_MINOR=${VERSION_MAJOR}.${VERSION_MINOR} | |
git tag --force -a "${TAG_MINOR}" -m "Release ${TAG_NAME}" | |
git push --force origin "${TAG_MINOR}" |