-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (29 loc) · 937 Bytes
/
release.yml
File metadata and controls
35 lines (29 loc) · 937 Bytes
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
name: Release
on:
release:
types: [published]
jobs:
update-tags:
name: Update Release Tags
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Update major version tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
TAG="${GITHUB_REF#refs/tags/}"
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
MAJOR_VERSION=$(echo "$TAG" | cut -d. -f1)
MAJOR_TAG="$MAJOR_VERSION"
echo "Creating/updating tag $MAJOR_TAG to point to $TAG"
git tag -fa "$MAJOR_TAG" -m "Update $MAJOR_TAG tag to $TAG"
git push origin "$MAJOR_TAG" --force
else
echo "Tag $TAG does not match semantic versioning format (v*.*.*)."
fi