Some checks are pending
website / build (push) Waiting to run
website / deploy (push) Blocked by required conditions
Publish python package to pypi and testpypi / Build distribution (push) Waiting to run
Publish python package to pypi and testpypi / Publish dist to pypi (push) Blocked by required conditions
Publish python package to pypi and testpypi / Test publishing to testpypi (push) Blocked by required conditions
67 lines
1.6 KiB
YAML
67 lines
1.6 KiB
YAML
name: Publish python package to pypi and testpypi
|
|
on: push
|
|
jobs:
|
|
build:
|
|
name: Build distribution
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.x'
|
|
- name: Install the latest version of uv
|
|
uses: astral-sh/setup-uv@v5
|
|
|
|
- name: Build the wheel and source tarball
|
|
run: uv build
|
|
- name: Store dist packages
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: python-package-distributions
|
|
path: dist/
|
|
|
|
publish-to-pypi:
|
|
name: Publish dist to pypi
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
needs:
|
|
- build
|
|
environment:
|
|
name: pypi
|
|
url: https://pypi.org/p/topen
|
|
permissions:
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Grab dist files
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: python-package-distributions
|
|
path: dist/
|
|
- name: Send off to PyPi
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
publish-to-testpypi:
|
|
name: Test publishing to testpypi
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build
|
|
environment:
|
|
name: testpypi
|
|
url: https://test.pypi.org/p/topen
|
|
permissions:
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Grab dist files
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: python-package-distributions
|
|
path: dist/
|
|
- name: Send off to TestPyPi
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
repository-url: https://test.pypi.org/legacy/
|