-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate pushing package to pypi (#1505)
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
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ] | ||
|
||
|
@@ -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: | | ||
|
@@ -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 * |