|
1 | | -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
2 | | -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions |
3 | | -name: Python package |
| 1 | +name: Update pypi release |
4 | 2 |
|
5 | 3 | on: |
6 | 4 | push: |
7 | | - branches: [ main ] |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
8 | 7 | pull_request: |
9 | | - branches: [ main ] |
10 | | - |
| 8 | + branches: |
| 9 | + - main |
| 10 | + - public |
| 11 | + types: |
| 12 | + - labeled |
| 13 | + - opened |
| 14 | + - edited |
| 15 | + - synchronize |
| 16 | + - reopened |
11 | 17 |
|
12 | 18 | jobs: |
13 | | - build: |
14 | | - |
| 19 | + release: |
15 | 20 | runs-on: ubuntu-latest |
16 | | - strategy: |
17 | | - # You can use PyPy versions in python-version. For example, pypy2 and pypy3 |
18 | | - matrix: |
19 | | - python-version: ["3.10"] |
20 | 21 |
|
21 | 22 | steps: |
22 | | - - uses: actions/checkout@v4 |
23 | | - - name: Set up Python ${{ matrix.python-version }} |
24 | | - uses: actions/setup-python@v4 |
25 | | - with: |
26 | | - python-version: ${{ matrix.python-version }} |
27 | | - # You can test your matrix by printing the current Python version |
28 | | - - name: Display Python version |
29 | | - run: python -c "import sys; print(sys.version)" |
30 | | - #test installation of DLC-core dependencies: |
31 | | - - name: Install dependencies |
32 | | - run: pip install . |
| 23 | + - name: Cache dependencies |
| 24 | + id: pip-cache |
| 25 | + uses: actions/cache@v4 |
| 26 | + with: |
| 27 | + path: ~/.cache/pip |
| 28 | + key: ${{ runner.os }}-pip |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + pip install --upgrade pip |
| 33 | + pip install wheel |
| 34 | + pip install "packaging>=24.2" |
| 35 | +
|
| 36 | + - name: Checkout code |
| 37 | + uses: actions/checkout@v3 |
| 38 | + |
| 39 | + - name: Build and publish to PyPI |
| 40 | + if: ${{ github.event_name == 'push' }} |
| 41 | + env: |
| 42 | + TWINE_USERNAME: __token__ |
| 43 | + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| 44 | + run: | |
| 45 | + make dist |
| 46 | + ls dist/ |
| 47 | + tar tvf dist/deeplabcut-live-*.tar.gz |
| 48 | + python3 -m twine upload --verbose dist/* |
0 commit comments