-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (38 loc) · 1.07 KB
/
tag-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
name: Build Release
on:
push:
tags:
- "v*"
permissions:
contents: write
packages: read
issues: write
defaults:
run:
# Error handling and pipefile must be explicitly set via the default shell
# https://github.com/actions/runner/issues/353#issuecomment-1067227665
shell: bash --noprofile --norc -eo pipefail {0}
jobs:
update-tags:
name: Update Major/Minor Tags
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Fetch the tags
run: git fetch --force --tags
- name: Force update the major tag
run: |
TAG=${GITHUB_REF/refs\/tags\//}
VERSION=${TAG#v}
MAJOR=${VERSION%%.*}
git tag v${MAJOR} ${TAG} -f
git push origin refs/tags/v${MAJOR} -f
- name: Force update the major/minor tag
run: |
TAG=${GITHUB_REF/refs\/tags\//}
VERSION=${TAG#v}
MAJOR_MINOR=${VERSION%.*}
git tag v${MAJOR_MINOR} ${TAG} -f
git push origin refs/tags/v${MAJOR_MINOR} -f