Skip to content
Open
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
51 changes: 51 additions & 0 deletions .github/workflows/publish-to-testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish to TestPyPI on release PR

on:
pull_request:
branches:
- main
types:
- opened
- synchronize

jobs:
build:
name: Build package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.x'

- run: pip install --upgrade build

- name: Build package
run: python -m build

- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
overwrite: true
if-no-files-found: error
retention-days: 1

publish-to-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download package
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
24 changes: 23 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: actions/setup-python@v6
with:
python-version: '3.x'

- run: pip install --upgrade build

- name: Build package
run: pyproject-build
- uses: actions/upload-artifact@v7
Expand All @@ -25,9 +28,27 @@ jobs:
if-no-files-found: error
retention-days: 1

publish-to-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Download package
uses: actions/download-artifact@v8
with:
name: dist
path: dist

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

publish:
name: Upload release to PyPI
needs: build
needs: publish-to-testpypi
runs-on: ubuntu-latest
permissions:
id-token: write
Expand All @@ -37,5 +58,6 @@ jobs:
with:
name: dist
path: dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Loading