Skip to content

Commit 95dfdf3

Browse files
MMathisLabCopilotCopilot
authored
Update GitHub Actions workflow for PyPI release (#158)
* Update GitHub Actions workflow for PyPI release * Add missing twine installation to PyPI release workflow (#159) * Initial plan * Add twine installation to PyPI release workflow Co-authored-by: MMathisLab <28102185+MMathisLab@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: MMathisLab <28102185+MMathisLab@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Replace `make dist` with `python -m build` in PyPI workflow (#160) * Initial plan * Replace make dist with python -m build in PyPI workflow Co-authored-by: MMathisLab <28102185+MMathisLab@users.noreply.github.com> * Reorder pip install to place build before twine Co-authored-by: MMathisLab <28102185+MMathisLab@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: MMathisLab <28102185+MMathisLab@users.noreply.github.com> --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: MMathisLab <28102185+MMathisLab@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 45715db commit 95dfdf3

File tree

1 file changed

+50
-23
lines changed

1 file changed

+50
-23
lines changed
Lines changed: 50 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,59 @@
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
42

53
on:
64
push:
7-
branches: [ main ]
5+
tags:
6+
- 'v*.*.*'
87
pull_request:
9-
branches: [ main ]
10-
8+
branches:
9+
- main
10+
- public
11+
types:
12+
- labeled
13+
- opened
14+
- edited
15+
- synchronize
16+
- reopened
1117

1218
jobs:
13-
build:
14-
19+
release:
1520
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"]
2021

2122
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: Setup Python
24+
id: setup-python
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: '3.x'
28+
29+
- name: Cache dependencies
30+
id: pip-cache
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cache/pip
34+
key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements.txt', 'setup.cfg', 'setup.py') }}
35+
restore-keys: |
36+
${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}-
37+
${{ runner.os }}-pip-
38+
39+
- name: Install dependencies
40+
run: |
41+
pip install --upgrade pip
42+
pip install wheel
43+
pip install "packaging>=24.2"
44+
pip install build
45+
pip install twine
46+
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Build and publish to PyPI
51+
if: ${{ github.event_name == 'push' }}
52+
env:
53+
TWINE_USERNAME: __token__
54+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
55+
run: |
56+
python -m build
57+
ls dist/
58+
tar tvf dist/deeplabcut_live-*.tar.gz
59+
python3 -m twine upload --verbose dist/*

0 commit comments

Comments
 (0)