Skip to content

Commit

Permalink
Automate pushing package to pypi (#349)
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
  • Loading branch information
benfred authored Apr 6, 2022
1 parent 7dc3bba commit f2dadf9
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions .github/workflows/tensorflow.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: tensorflow

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

jobs:
tests:
Expand Down Expand Up @@ -39,6 +42,14 @@ jobs:
- name: Run unittests
run: |
make tests-tf
- 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 the documentation, TODO: SPHINXOPTS="-W -q"
- name: Make HTML
run: |
Expand All @@ -61,3 +72,28 @@ jobs:
with:
name: pr
path: pr/

release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [tests]
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 f2dadf9

Please sign in to comment.