forked from python/tzdata
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (41 loc) · 1.22 KB
/
auto-tag.yml
File metadata and controls
46 lines (41 loc) · 1.22 KB
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: Auto Tag on Version Bump
on:
push:
branches:
- master
paths:
- VERSION
jobs:
tag-repo:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: true # Needed to push the tag
- name: Get current version
id: version
run: |
VERSION=$(cat VERSION)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Check if tag already exists
id: checktag
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
if git rev-parse "${VERSION}" >/dev/null 2>&1; then
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Push tag
if: steps.checktag.outputs.skip == 'false'
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "${VERSION}"
git push origin "${VERSION}"