46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: PyPI Release
|
|
|
|
# https://help.github.com/en/actions/reference/events-that-trigger-workflows
|
|
on: # Trigger the workflow on push or pull request, but only for the master branch
|
|
push:
|
|
branches: [master]
|
|
release:
|
|
types: [created]
|
|
|
|
|
|
jobs:
|
|
# based on https://github.com/pypa/gh-action-pypi-publish
|
|
build-publish:
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.7
|
|
|
|
- name: Install dependencies
|
|
run: >-
|
|
python -m pip install --user --upgrade setuptools wheel
|
|
- name: Build
|
|
run: |
|
|
python setup.py sdist bdist_wheel
|
|
ls -lh dist/
|
|
|
|
# We do this, since failures on test.pypi aren't that bad
|
|
- name: Publish to Test PyPI
|
|
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
|
uses: pypa/gh-action-pypi-publish@master
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.test_pypi_password }}
|
|
repository_url: https://test.pypi.org/legacy/
|
|
verbose: true
|
|
|
|
- name: Publish distribution 📦 to PyPI
|
|
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
|
uses: pypa/gh-action-pypi-publish@master
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.pypi_password }}
|