-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix workflow syntax error fix on error fix no tag error fix error improve workflow Move workflow logic to a separate repo Remove workflow comments
- Loading branch information
1 parent
b93104b
commit c7b2734
Showing
1 changed file
with
25 additions
and
41 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,33 @@ | ||
name: Publish Python π distributions π¦ to PyPI and TestPyPI | ||
name: Publish Python π distributions π¦ | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
publish_dest: | ||
type: choice | ||
required: true | ||
default: TestPyPI | ||
description: Where to publish this package | ||
options: | ||
- TestPyPI | ||
- PyPI | ||
ref: | ||
description: 'Commit SHA or tag to package' | ||
publish_testpypi: | ||
type: boolean | ||
default: false | ||
description: Publish to TestPyPI | ||
publish_pypi: | ||
type: boolean | ||
default: false | ||
description: Publish to PyPI | ||
publish_gh_release: | ||
type: boolean | ||
default: true | ||
description: Publish to GitHub Release | ||
release_tag: | ||
type: string | ||
description: Tag to package (empty for latest tag) | ||
required: false | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python π distributions π¦ to PyPI and TestPyPI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref || github.sha }} | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
- 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: Publish distribution π¦ to Test PyPI | ||
if: ${{ inputs.publish_dest == 'TestPyPI' }} | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ | ||
- name: Publish distribution π¦ to PyPI | ||
if: ${{ inputs.publish_dest == 'PyPI' }} | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
uses: atomiechen/reusable-workflows/.github/workflows/publish-python-distributions.yml@main | ||
with: | ||
publish_testpypi: ${{ inputs.publish_testpypi }} | ||
publish_pypi: ${{ inputs.publish_pypi }} | ||
publish_gh_release: ${{ inputs.publish_gh_release }} | ||
release_tag: ${{ inputs.release_tag }} | ||
secrets: | ||
TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} |