-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Chore: add action to move major version tag
- Loading branch information
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
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
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 |