Skip to content

Upload Python Package to TestPyPI #4

Upload Python Package to TestPyPI

Upload Python Package to TestPyPI #4

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow has yet to be tested
name: Upload Python Package to TestPyPI
on:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build the disctribution package
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
release-on-pypi:
name: Release distribution packages on TestPyPI
needs:
- build
runs-on: ubuntu-latest
permissions:
id-token: write
environment: testpypi
steps:
- name: Download the distribution packages
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
repository-url: https://test.pypi.org/legacy/