Skip to content

Commit

Permalink
Cleanup GitHub actions.
Browse files Browse the repository at this point in the history
 - One build for sdist package.
 - One build for Python 3 wheel.
 - One build for Python 2 wheel.
  • Loading branch information
mithro committed Mar 5, 2021
1 parent 617e53a commit 148f71c
Showing 1 changed file with 57 additions and 12 deletions.
69 changes: 57 additions & 12 deletions templates/.github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,67 @@ on:
- master

jobs:
build-n-publish:
sdist:
name: sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
# Always clone the full depth so git-describe works.
fetch-depth: 0
submodules: true

- name: Set up Python 🐍 3
uses: actions/setup-python@v2
with:
python-version: 3.x

- name: Install build dependencies
run: |
pip install -U pip
pip install -U setuptools wheel twine
- name: Install package dependencies
run: |
python setup.py install
- name: Run smoke test
run: |
python test.py
- name: Build distribution 📦
run: |
python setup.py sdist
rm dist/*.egg
- name: Check distribution 📦
run: |
du -h dist/*
twine check dist/*
- name: Publish to Test PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
twine upload --skip-existing --repository testpypi dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --skip-existing dist/*
wheels:
strategy:
matrix:
python-version: [ '2.x', '3.6', '3.7', '3.8', '3.9', 'pypy-2.7', 'pypy-3.6', 'pypy-3.7' ]
os: [ubuntu-latest]
python-version: [ '2.x', '3.x' ]
fail-fast: false

name: ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand All @@ -29,13 +80,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

# - name: Get full Python 🐍 version
# id: full-python-version
# run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")

# - name: Get repo version
# run: echo ::set-output name=repo-version::$(python -c "import setup; print(setup.version_str)")

- name: Install build dependencies
run: |
pip install -U pip
Expand All @@ -51,7 +95,7 @@ jobs:
- name: Build distribution 📦
run: |
python setup.py sdist bdist_wheel
python setup.py bdist_wheel
rm dist/*.egg
- name: Check distribution 📦
Expand All @@ -72,3 +116,4 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload --skip-existing dist/*

0 comments on commit 148f71c

Please sign in to comment.