-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (50 loc) · 1.75 KB
/
Copy pathpublish.yml
File metadata and controls
63 lines (50 loc) · 1.75 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
# .github/workflows/publish.yml
name: Publish Python 🐍 distributions to PyPI
on:
# This workflow is triggered manually from the GitHub Actions UI
workflow_dispatch:
concurrency:
group: publish
cancel-in-progress: false
jobs:
build-and-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
environment: pypi-publish
# These permissions are essential for trusted publishing
permissions:
id-token: write # This is required for passwordless deployment
steps:
- name: Checkout repository
uses: actions/checkout@v4
# It's a good practice to fetch all history for a more accurate version number
with:
fetch-depth: 0
- name: Install uv and set the Python version
uses: astral-sh/setup-uv@v6
with:
# Install a specific version of uv.
version: 0.9.7
python-version: "3.9"
enable-cache: true
- name: Install dependencies and project
run: uv sync --locked --all-extras --dev
- name: Install build dependencies
run: uv pip install build setuptools wheel
- name: Build package
run: uv run python -m build
- name: Verify build module installation
run: uv pip show build
- name: Upload built distributions
uses: actions/upload-artifact@v4
with:
name: dist-files
path: dist/*
# - name: Publish package to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# The `id-token: write` permission allows this action to get a temporary
# token from GitHub's OIDC provider, which PyPI trusts. No API token needed here.
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/