adding publishing workflow
@@ -7,9 +7,11 @@ on:
pull_request:
branches:
- main
+ release:
+ types: [published]
jobs:
- build:
+ tests:
name: "${{ matrix.pymc-version }} on py${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
@@ -61,3 +63,51 @@ jobs:
else
coveralls
fi
+
+ build:
+ name: Build source distribution
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ submodules: true
+
+ - uses: actions/setup-python@v2
+ name: Install Python
+ with:
+ python-version: "3.8"
+
+ - name: Build
+ run: |
+ python -m pip install -U pip pep517 twine setuptools_scm
+ python -m pep517.build .
+ - name: Test the sdist
+ run: |
+ python -m venv venv-sdist
+ venv-sdist/bin/python -m pip install dist/exoplanet*.tar.gz
+ venv-sdist/bin/python -c "import exoplanet;print(exoplanet.__version__)"
+ - name: Test the wheel
+ run: |
+ python -m venv venv-wheel
+ venv-wheel/bin/python -m pip install dist/exoplanet*.whl
+ venv-wheel/bin/python -c "import exoplanet;print(exoplanet.__version__)"
+ - uses: actions/upload-artifact@v2
+ with:
+ path: dist/*
+
+ upload_pypi:
+ needs: [tests, build]
+ runs-on: ubuntu-latest
+ if: github.event_name == 'release' && github.event.action == 'published'
+ steps:
+ - uses: actions/download-artifact@v2
+ with:
+ name: artifact
+ path: dist
+
+ - uses: pypa/gh-action-pypi-publish@master
+ with:
+ user: __token__
+ password: ${{ secrets.pypi_password }}
+ # To test: repository_url: https://test.pypi.org/legacy/
