2020-04-02 15:47:37 +00:00
|
|
|
name: PyPI Release
|
|
|
|
|
2020-04-07 15:55:27 +00:00
|
|
|
# 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
|
2020-04-07 18:04:32 +00:00
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- created
|
2020-04-02 15:47:37 +00:00
|
|
|
|
|
|
|
# based on https://github.com/pypa/gh-action-pypi-publish
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2020-04-26 20:10:58 +00:00
|
|
|
- uses: actions/checkout@v2
|
2020-04-02 15:47:37 +00:00
|
|
|
- name: Set up Python 3.7
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
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
|
2020-04-26 20:10:58 +00:00
|
|
|
|
2020-04-02 15:47:37 +00:00
|
|
|
# We do this, since failures on test.pypi aren't that bad
|
|
|
|
- name: Publish to Test PyPI
|
2020-04-07 19:42:19 +00:00
|
|
|
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
2020-04-02 15:47:37 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@master
|
|
|
|
with:
|
2020-04-07 13:49:38 +00:00
|
|
|
user: __token__
|
2020-04-02 15:47:37 +00:00
|
|
|
password: ${{ secrets.test_pypi_password }}
|
|
|
|
repository_url: https://test.pypi.org/legacy/
|
|
|
|
|
|
|
|
- name: Publish distribution 📦 to PyPI
|
2020-04-07 19:42:19 +00:00
|
|
|
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'
|
2020-04-02 15:47:37 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@master
|
|
|
|
with:
|
2020-04-07 13:49:38 +00:00
|
|
|
user: __token__
|
2020-04-02 15:47:37 +00:00
|
|
|
password: ${{ secrets.pypi_password }}
|