Skip to content

Commit 2d36762

Browse files
author
Mindee
committed
test
1 parent ba0fa1e commit 2d36762

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/tag-version.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Tag Version
2+
3+
on:
4+
push:
5+
branches:
6+
- tag-test
7+
8+
jobs:
9+
tag-version:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Get version
15+
id: get_version
16+
run: |
17+
msg_start=':bookmark: Version '
18+
version=$(\
19+
git log -1 --skip=0 --pretty=%s |\
20+
grep -oP "(?<=${msg_start})[0-9]{1,}\.[0-9]{1,}\.[0-9]{1,}" |\
21+
true\
22+
)
23+
24+
if [ -z "${version}" ]; then
25+
echo 'Version not found, exiting.'
26+
exit 0
27+
fi
28+
29+
echo "Found version: ${version}";
30+
tag="v${version}";
31+
32+
echo "Would tag: ${tag}";
33+
existing_tag=$(git tag -l "$tag");
34+
if [ "${existing_tag}" ]; then
35+
echo "Tag '${existing_tag}' already exists, aborting.";
36+
exit 1;
37+
fi

0 commit comments

Comments
 (0)