-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.63 KB
/
publish_pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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' }}