-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (37 loc) · 1.18 KB
/
tag.yml
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
name: Tag with Latest Version on PR Merge
on:
pull_request:
types: [ closed ]
jobs:
tag-on-merge:
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b
with:
python-version: '3.11'
- name: Install Requirements
run: |
pip install --upgrade pip poetry
- name: Set up Git
run: |
git config user.name "dac-bot[bot]"
git config user.email "[email protected]"
- name: Check and update tag
run: |
VERSION="v$(poetry version --short)"
if [[ $(git tag -l $VERSION) ]]; then
echo "Tag $VERSION already exists"
else
echo "Tagging with $VERSION"
git tag "$VERSION"
git push origin --tags
fi