-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (56 loc) · 1.86 KB
/
Copy pathpython-publish.yml
File metadata and controls
68 lines (56 loc) · 1.86 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
61
62
63
64
65
66
67
68
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [created]
jobs:
update_version:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
new-sha: ${{ steps.get-sha.outputs.sha }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.target_commitish }}
fetch-depth: 0
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set Release version
run: uv version ${{ github.event.release.tag_name }}
- name: Commit and push changes
id: get-sha
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add pyproject.toml
git commit -m "chore: bump version to ${{ github.event.release.tag_name }}"
git push
echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
publish:
name: Publish to PyPI
needs: update_version
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.update_version.outputs.new-sha }}
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build package
run: uv build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1