Skip to content

Publish to TestPyPI or PyPI #33

Publish to TestPyPI or PyPI

Publish to TestPyPI or PyPI #33

Workflow file for this run

name: Publish to TestPyPI or PyPI
on:
workflow_dispatch:
inputs:
pypi_repo:
description: 'Repo to upload to'
default: 'testpypi'
required: true
python_version:
description: 'Python version'
default: '3.9'
required: true
platform:
description: 'Platform'
default: 'ubuntu-latest'
required: true
jobs:
build:
name: Publish a package
runs-on: ${{ github.event.inputs.platform }}
steps:
- uses: actions/checkout@master
- name: Initialize Python
uses: actions/setup-python@v1
with:
python-version: ${{ github.event.inputs.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
pip install wheel
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
- name: Build package
run: python setup.py bdist_wheel
- name: Publish package to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.TEST_PYPI_SECRET }}
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@master
with:
user: __token__
password: ${{ secrets.PYPI_SECRET }}
if: ${{ github.event.inputs.pypi_repo == 'pypi' }}