Skip to content

Workflow file for this run

# This release workflow was created using the following guide
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python 🐍 distribution πŸ“¦ to PyPI and TestPyPI
on:
release:
types:
- released
jobs:
test:
name: Test the latest release commit
uses: ./.github/workflows/tests.yml
lint:
name: Lint the latest release commit
uses: ./.github/workflows/lint.yml
build:
name: Build distribution πŸ“¦
needs:
- test
- lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
name: Publish Python 🐍 distribution πŸ“¦ to TestPyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/fundus
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution πŸ“¦ to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Sleep for 2 minutes
run: sleep 2m
shell: bash
test-distribution:
name: Install and test TestPyPi distribution
needs:
- publish-to-testpypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install package
run: >-
python3 -m
pip install
--index-url https://test.pypi.org/simple/
--extra-index-url https://pypi.org/simple/
fundus==${{ github.event.release.tag_name }}
publish-to-pypi:
name: Publish Python 🐍 distribution πŸ“¦ to PyPI
needs:
- test-distribution
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/fundus
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution πŸ“¦ to PyPI
uses: pypa/gh-action-pypi-publish@release/v1