Publish to TestPyPI and PyPI #31
Workflow file for this run
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 to TestPyPI and PyPI | |
on: | |
workflow_dispatch: | |
inputs: | |
pypi_repo: | |
description: "Repo to upload to (TestPyPI or PyPI)" | |
default: "testpypi" | |
required: true | |
jobs: | |
build_wheels: | |
uses: ./.github/workflows/wheels.yml | |
publish: | |
name: Publish to TestPyPI and PyPI | |
runs-on: ubuntu-latest | |
needs: [build_wheels] | |
steps: | |
- name: Download wheels and sdist | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: artifact-* | |
path: ./download | |
- name: Copy to dist | |
run: | | |
[ -d dist ] && rm -rf dist | |
mkdir dist | |
cp ./download/*/*.whl ./dist | |
cp ./download/*/*.tar.gz ./dist | |
shell: bash | |
- name: Show files to upload | |
run: | | |
ls -la dist | |
shell: bash | |
- name: Publish package to TestPyPI | |
uses: pypa/gh-action-pypi-publish@v1.8.14 | |
with: | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
if: ${{ github.event.inputs.pypi_repo == 'testpypi' }} | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@v1.8.14 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_TOKEN }} | |
if: ${{ github.event.inputs.pypi_repo == 'pypi' }} |