Skip to content

Publish to PyPI

Publish to PyPI #356

name: Publish to PyPI
on:
create:
tags:
- v*
# I am not sure which one is better:
# workflow_run:
# workflows: [pre-merge_actions]
# types:
# - completed
workflow_call:
secrets:
PYPI_API_TOKEN:
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: pip install wheel
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish package
id: publish
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Report Skip
if: (! startsWith(github.ref, 'refs/tags'))
run: |
echo "Publication to PyPI skipped!"
echo "Event Name: ${GITHUB_EVENT_NAME}"
echo "Event: ${GITHUB_EVENT}"
echo "Event Ref: ${GITHUB_REF}"