Skip to content

Commit

Permalink
Automate pushing package to pypi (#1505)
Browse files Browse the repository at this point in the history
After tagging a release, this will automatically push the package the pypi
as well as create the github release attaching the same sdist package to
the release attachments.
  • Loading branch information
benfred authored Apr 6, 2022
1 parent e151b01 commit 4e48e13
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/cpu-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: CPU CI

on:
workflow_dispatch:
push:
branches: [ main ]
tags:
- v*
pull_request:
branches: [ main ]

Expand Down Expand Up @@ -56,6 +59,14 @@ jobs:
- name: Run unittests
run: |
python -m pytest -rxs tests/unit/
- name: Generate package for pypi
run: |
python setup.py sdist
- name: Upload artifacts to github
uses: actions/upload-artifact@v2
with:
name: dist
path: dist
# Build docs, treat warnings as errors
- name: Building docs
run: |
Expand All @@ -78,3 +89,28 @@ jobs:
with:
name: pr
path: pr/

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [build]
steps:
- uses: actions/download-artifact@v2
with:
name: dist
- name: Create GitHub Release
uses: fnkr/[email protected]
env:
GHR_PATH: .
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Push to PyPi
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade wheel pip setuptools twine
twine upload *

0 comments on commit 4e48e13

Please sign in to comment.