Publish a release to PyPI #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish a release to PyPI | |
on: | |
workflow_dispatch: | |
inputs: | |
test_pypi: | |
type: boolean | |
default: false | |
description: "Publish to the test PyPI instance, https://test.pypi.org/" | |
jobs: | |
build: | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.11" | |
- name: Install build | |
run: python -m pip install build | |
- name: Build Source Distribution and Wheel | |
run: python -m build --sdist --wheel --outdir dist/ . | |
- name: Publish adam_core to Test PyPI | |
if: ${{ inputs.test_pypi }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_SECRET }} | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish adam_core to PyPI | |
if: ${{ ! inputs.test_pypi }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_SECRET }} |