-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (50 loc) · 1.72 KB
/
create_release_tag.yaml
File metadata and controls
60 lines (50 loc) · 1.72 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Create Release Tag
permissions:
contents: write
on:
workflow_dispatch:
jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout Main Branch
uses: actions/checkout@v4
with:
ref: "main"
fetch-depth: 0
token: ${{ secrets.LIBRARY_RELEASE_PAT }}
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "poetry"
- name: Get Version from pyproject.toml
id: get_version
run: |
VERSION=$(poetry version -s)
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "TAG=v${VERSION}" >> $GITHUB_OUTPUT
- name: Check if Tag Already Exists
id: check_tag
run: |
if git rev-parse "refs/tags/${{ steps.get_version.outputs.TAG }}" >/dev/null 2>&1; then
echo "Tag ${{ steps.get_version.outputs.TAG }} already exists. Bump version in pyproject.toml and retry."
exit 1
fi
- name: Setup Git Config
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Create and Push Tag
run: |
git tag -a "${{ steps.get_version.outputs.TAG }}" -m "Release version ${{ steps.get_version.outputs.VERSION }}"
git push origin "${{ steps.get_version.outputs.TAG }}"
- name: Create GitHub Release
run: |
gh release create "${{ steps.get_version.outputs.TAG }}" \
--title "${{ steps.get_version.outputs.TAG }}" \
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.LIBRARY_RELEASE_PAT }}