Refactor Python package release workflow #43
Workflow file for this run
This file contains hidden or 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
| name: Update pypi release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| types: | |
| - labeled | |
| - opened | |
| - edited | |
| - synchronize | |
| - reopened | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup Python | |
| id: setup-python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Cache dependencies | |
| id: pip-cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'setup.cfg', 'setup.py') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}- | |
| ${{ runner.os }}-pip- | |
| - name: Install Qt/OpenGL runtime deps (Ubuntu) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libegl1 \ | |
| libgl1 \ | |
| libopengl0 \ | |
| libxkbcommon-x11-0 \ | |
| libxcb-cursor0 | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install wheel | |
| pip install "packaging>=24.2" | |
| pip install build | |
| pip install twine | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build and publish to PyPI | |
| if: ${{ github.event_name == 'push' }} | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} | |
| run: | | |
| python -m build | |
| ls dist/ | |
| tar tvf dist/deeplabcut-live-gui-*.tar.gz | |
| python3 -m twine upload --verbose dist/* |