Skip to content

Commit d39e26b

Browse files
committed
gha: Add workflow to update major tag
1 parent 5e20d4e commit d39e26b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Update major tag
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-18.04
10+
steps:
11+
12+
- uses: actions/checkout@v1
13+
14+
- name: Update major tag
15+
if: github.event.release.prerelease == false
16+
run: |
17+
git config user.name "${GITHUB_ACTOR}"
18+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
19+
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
20+
export TAG_NAME="${GITHUB_REF##refs/tags/}"
21+
export TAG_MAJOR="${TAG_NAME%%.*}"
22+
git tag "${TAG_MAJOR}" || git tag -d "${TAG_MAJOR}" ; git push origin ":refs/tags/${TAG_MAJOR}"
23+
git tag "${TAG_MAJOR}" || true
24+
git push --tags origin

0 commit comments

Comments
 (0)