Skip to content

Commit

Permalink
CI/CD: Create deploy job
Browse files Browse the repository at this point in the history
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
jarsarasty authored and jackvreeken committed Jan 28, 2025
1 parent 7528b4f commit 53e69d2
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions .github/workflows/rtc-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 53e69d2

Please sign in to comment.