-
Notifications
You must be signed in to change notification settings - Fork 4
51 lines (42 loc) · 1.06 KB
/
Copy pathpython-publish.yml
File metadata and controls
51 lines (42 loc) · 1.06 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
name: Upload Python Package
on:
release:
types: [created]
permissions:
contents: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Check out repository
uses: actions/checkout@v5
- name: Get the tag name for the release
id: vars
shell: bash
run: |
tag="${GITHUB_REF#refs/*/}" # refs/tags/1.2.3 -> 1.2.3
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: latest
python-version: '3.13'
enable-cache: true
- name: Install project
run: uv sync --all-extras
- name: Build package
shell: bash
run: uv build
- name: Upload built packages to release
shell: bash
run: |
gh release upload "${{ steps.vars.outputs.tag }}" dist/* --clobber
env:
GH_TOKEN: ${{ github.token }}
- name: Publish to PyPI
shell: bash
run: uv publish
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}