Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate pushing package to pypi #1505

Merged
merged 1 commit into from
Apr 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 *