10BC0 Add auto-tag workflow (#110) · python/tzdata@7ef7c61 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7ef7c61

Browse files
Add auto-tag workflow (#110)
* Add auto-tag workflow Runs when the version is bumped, creates and pushes a tag.
1 parent 3fec560 commit 7ef7c61

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/auto-tag.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Auto Tag on Version Bump
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- VERSION
9+
10+
jobs:
11+
tag-repo:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- name: Check out repository
17+
uses: actions/checkout@v5
18+
19+
- name: Get current version
20+
id: version
21+
run: |
22+
VERSION=$(cat VERSION)
23+
echo "version=$VERSION" >> $GITHUB_OUTPUT
24+
25+
- name: Check if tag already exists
26+
id: checktag
27+
run: |
28+
if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
29+
echo "skip=true" >> $GITHUB_OUTPUT
30+
else
31+
echo "skip=false" >> $GITHUB_OUTPUT
32+
fi
33+
34+
- name: Push tag
35+
if: steps.checktag.outputs.skip == 'false'
36+
run: |
37+
git config user.name "github-actions[bot]"
38+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
39+
git tag "v${{ steps.version.outputs.version }}"
40+
git push origin "v${{ steps.version.outputs.version }}"

0 commit comments

Comments
 (0)
0