|
| 1 | +name: Publish Python 🐍 distributions 📦 to PyPI |
| 2 | +on: |
| 3 | + release: |
| 4 | + types: [published] |
| 5 | + |
| 6 | +jobs: |
| 7 | + build-n-publish: |
| 8 | + name: Build and publish Python 🐍 distributions 📦 to TestPyPI |
| 9 | + runs-on: ubuntu-18.04 |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@2 |
| 12 | + with: |
| 13 | + submodules: 'recursive' |
| 14 | + - name: Set up Python 3.8 |
| 15 | + uses: actions/setup-python@v2 |
| 16 | + with: |
| 17 | + python-version: 3.8 |
| 18 | + - name: Install python dependencies |
| 19 | + env: |
| 20 | + PYTHONWARNINGS: ignore:DEPRECATION::pip._internal.cli.base_command |
| 21 | + run: | |
| 22 | + python -m pip install --upgrade pip |
| 23 | + pip install numpy==1.18.1 |
| 24 | + - name: Install c++ dependencies (ubuntu) |
| 25 | + run: | |
| 26 | + sudo apt-get -y install libpcre2-dev libsparsehash-dev doxygen |
| 27 | + - name: Set gcc envvars |
| 28 | + run: | |
| 29 | + echo ::set-env name=CC::gcc-8 |
| 30 | + echo ::set-env name=CXX::g++-8 |
| 31 | + - name: Build sdist |
| 32 | + run: python setup.py sdist |
| 33 | + |
| 34 | + - name: Publish distribution 📦 to Test PyPI |
| 35 | + uses: pypa/gh-action-pypi-publish@master |
| 36 | + with: |
| 37 | + skip_existing: true |
| 38 | + password: ${{ secrets.test_pypi_password }} |
| 39 | + repository_url: https://test.pypi.org/legacy/ |
| 40 | + |
| 41 | + - name: Install from test and test running |
| 42 | + run: | |
| 43 | + pip install --extra-index-url https://test.pypi.org/simple libpy |
| 44 | + python -c 'import libpy;print(libpy.__version__)' |
| 45 | + pip uninstall -y libpy |
| 46 | +
|
| 47 | + - name: Publish distribution 📦 to PyPI |
| 48 | + uses: pypa/gh-action-pypi-publish@master |
| 49 | + with: |
| 50 | + skip_existing: true |
| 51 | + password: ${{ secrets.pypi_password }} |
| 52 | + |
| 53 | + - name: Install and test running |
| 54 | + run: | |
| 55 | + pip install libpy |
| 56 | + python -c 'import libpy;print(libpy.__version__) |
| 57 | +
|
| 58 | + - name: Build the docs |
| 59 | + run: | |
| 60 | + pip install sphinx sphinx_rtd_theme breathe ipython |
| 61 | + make docs |
| 62 | +
|
| 63 | + - name: Deploy the docs |
| 64 | + uses: peaceiris/actions-gh-pages@v3 |
| 65 | + with: |
| 66 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + publish_dir: ./docs/build/html |
0 commit comments