forked from iMicknl/python-overkiz-api
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (45 loc) · 1.72 KB
/
release.yml
File metadata and controls
59 lines (45 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
# This workflow will upload the package to PyPi when a release is published
name: Publish Python Package (PyPi)
on:
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing via PyPi
id-token: write
contents: write
steps:
- uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Retrieve version from tag name
id: retrieve-version
run: |
tag=${{ github.event.release.tag_name }}
version_number=${tag#?}
echo version: $version_number
echo "version=$version_number" >> $GITHUB_OUTPUT
- name: Bump project version in pyproject.toml and commit changes to current branch and tag
run: |
VERSION=${{ steps.retrieve-version.outputs.version }}
uvx --from=toml-cli toml set --toml-path=pyproject.toml project.version $VERSION
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add pyproject.toml
git commit -m "Bump package version to ${{ steps.retrieve-version.outputs.version }}."
git tag -f -a ${{ github.event.release.tag_name }} -m "Release ${{ steps.retrieve-version.outputs.version }}."
git push origin HEAD:main
git push origin -f ${{ github.event.release.tag_name }}
- name: Build package
run: |
uv build
- name: Publish package to PyPI
run: |
uv publish