Add a GitHub Action to build + Upload black to PyPI (#1848)

* Add a GitHub Action to build + Upload black to PyPI
- Build a wheel + sdist
- Upload via twine using token stored in GitHub secrets
This commit is contained in:
Cooper Lees 2021-04-01 09:41:55 -07:00 committed by GitHub
parent 9451c57d1c
commit 125ed5b260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 6 deletions

View File

@ -12,17 +12,14 @@ jobs:
github.repository github.repository
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }} - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: 3.7
- name: Install dependencies - name: Install dependencies
run: | run: |

31
.github/workflows/pypi_upload.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: pypi_upload
on:
release:
types: created
jobs:
build:
name: PyPI Upload
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Install latest pip, setuptools, twine + wheel
run: |
python -m pip install --upgrade pip setuptools twine wheel
- name: Build wheels
run: |
python setup.py bdist_wheel
python setup.py sdist
- name: Upload to PyPI via Twine
env:
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload --verbose -u '__token__' dist/*

View File

@ -13,7 +13,7 @@ repos:
types_or: [python, pyi] types_or: [python, pyi]
- repo: https://gitlab.com/pycqa/flake8 - repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1 rev: 3.8.4
hooks: hooks:
- id: flake8 - id: flake8
additional_dependencies: [flake8-bugbear] additional_dependencies: [flake8-bugbear]