Skip to content

Commit 2c4653c

Browse files
committed
Add PyPI release workflow and rename CI file
Add a new GitHub Actions workflow (python-package.yml) to build and publish packages to PyPI. The workflow triggers on tag pushes (v*.*.*) and on PR events, sets up Python, caches pip, installs build tooling (build, twine, packaging), builds the package, and uploads artifacts to PyPI using TWINE_API_KEY. Also rename .github/workflows/ci.yml to .github/workflows/testing-ci.yml to clarify CI purpose.
1 parent 0b26c85 commit 2c4653c

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Update pypi release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
pull_request:
8+
branches:
9+
- main
10+
- public
11+
types:
12+
- labeled
13+
- opened
14+
- edited
15+
- synchronize
16+
- reopened
17+
18+
jobs:
19+
release:
20+
runs-on: ubuntu-latest
21+
22+
steps:
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.TWINE_API_KEY }}
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)