Skip to content

Commit a1e92b4

Browse files
committed
feat(ci): Add action to add SemVer tags
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
1 parent 9a3f211 commit a1e92b4

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/release-tag.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# SPDX-FileCopyrightText: 2023-2024 Steffen Vogel <post@steffenvogel.de>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# yaml-language-server: $schema=https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json
5+
---
6+
name: Tag Semver
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
semver-tag:
15+
name: Add a Semantic Versioned Tag
16+
runs-on: ubuntu-latest
17+
18+
permissions:
19+
contents: write
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
token: ${{ secrets.PAT }}
26+
27+
- uses: actions/setup-go@v5
28+
with:
29+
go-version: '1.22.2'
30+
31+
- name: Setup svu
32+
run: |
33+
go install github.com/caarlos0/svu@latest
34+
35+
- name: Create new tag
36+
run: |
37+
CURRENT=$(svu current)
38+
NEXT=$(svu next)
39+
40+
if [ ${CURRENT} != ${NEXT} ]; then
41+
git tag ${NEXT}
42+
git push origin tag ${NEXT}
43+
44+
echo "Tagged new release with ${NEXT}"
45+
else
46+
echo "No new commits to tag"
47+
fi

0 commit comments

Comments
 (0)