Skip to content

Commit

Permalink
ENG-4786 tag mover (#12)
Browse files Browse the repository at this point in the history
* Chore: add action to move major version tag
  • Loading branch information
zherner authored Mar 29, 2024
1 parent 6ec9a7b commit 3ce970c
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/update-major-version-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Update major version tag

on:
release:
types:
- published

permissions:
contents: read

jobs:
update_main_version:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update major version tag
run: |
# get latest tag
tag=$(git describe --tags --abbrev=0)
if [[ $? -ne 0 ]]; then
echo "No tag found, exiting..."; exit 1
fi
# check if tag matches pattern
if [[ $tag =~ v[0-9]+.[0-9]+.[0-9] ]]; then
# remove minor and patch versions
tag=${tag%%.*}
# push new major version tag
git tag --force $tag
git push origin $tag --force
echo "Successfully moved tag: '${tag}'"
else
echo "The tag: '${tag}' does not match expected pattern of 'v\d+.\d+.\d', exiting..."; exit 1
fi

0 comments on commit 3ce970c

Please sign in to comment.