Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ on:

permissions:
contents: read
id-token: write # required for PyPI Trusted Publishing (OIDC)
id-token: write

jobs:
build-and-publish:
runs-on: ubuntu-latest
environment: pypi # optional but recommended if you configured trusted publisher w/ env
environment: pypi

steps:
- name: Check out source
Expand All @@ -25,16 +25,13 @@ jobs:
- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build
python -m pip install build twine

- name: Build sdist and wheel
run: python -m build
- name: Build distributions
run: python -m build --outdir dist

# Optional sanity check: verify metadata, long_description, etc.
- name: Check dist
run: |
python -m pip install twine
twine check dist/*
- name: Check distributions
run: twine check dist/*

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/test_pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish to TestPyPI

on:
push:
branches: [main]

permissions:
contents: read
id-token: write

jobs:
build-and-publish:
runs-on: ubuntu-latest
environment: testpypi

steps:
- name: Check out source
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install build tools
run: |
python -m pip install --upgrade pip
python -m pip install build twine

- name: Build distributions
run: python -m build --outdir dist

- name: Check distributions
run: twine check dist/*

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
repository-url: https://test.pypi.org/legacy/