-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a separate workflow for deploying is possible, but to _also_ make it depend on the tests succeeding is difficult. We would have to use the `workflow_run` event, but that one cannot filter on tags, only on branches. As such, we might as well add it to the overall workflow.
- Loading branch information
1 parent
7528b4f
commit 53e69d2
Showing
1 changed file
with
31 additions
and
14 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 |
---|---|---|
|
@@ -95,17 +95,34 @@ jobs: | |
- run: pip install tox | ||
- run: tox -vv | ||
|
||
# deploy: | ||
# needs: examples-linux | ||
# runs-on: ubuntu-latest | ||
# container: | ||
# image: python:3.9 | ||
# if: (github.ref == 'refs/tags//^2\..*$/') && !(startsWith(github.ref, 'refs/heads')) | ||
# timeout-minutes: 30 | ||
# steps: | ||
# - uses: actions/[email protected] | ||
# - uses: actions/[email protected] | ||
# with: | ||
# name: "${{ github.job }}" | ||
# - run: pip install twine | ||
# - run: twine upload -u $PYPI_USER -p $PYPI_PASSWORD dist/* | ||
deploy: | ||
needs: [test-linux, examples-linux] | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install build dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build twine | ||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Publish package to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: | | ||
if [ "${{ github.ref }}" == "refs/heads/master" ]; then | ||
twine upload dist/* | ||
else | ||
twine upload --repository-url https://test.pypi.org/legacy/ dist/* | ||
fi |