Skip to content

Commit cc9c828

Browse files
pypi release workflow (#305)
1 parent 25b678b commit cc9c828

File tree

3 files changed

+73
-2
lines changed

3 files changed

+73
-2
lines changed

.github/workflows/publish.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install Poetry
21+
uses: snok/install-poetry@v1
22+
with:
23+
version: latest
24+
virtualenvs-create: true
25+
virtualenvs-in-project: true
26+
27+
- name: Extract version from pyproject.toml
28+
id: get_version
29+
run: |
30+
# Extract version from [project] section
31+
VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
32+
echo "project_version=$VERSION" >> $GITHUB_OUTPUT
33+
echo "Project version: $VERSION"
34+
35+
- name: Extract tag version
36+
id: get_tag
37+
run: |
38+
# Remove 'refs/tags/' prefix and optional 'v' prefix
39+
TAG_VERSION=${GITHUB_REF#refs/tags/}
40+
TAG_VERSION=${TAG_VERSION#v}
41+
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
42+
echo "Tag version: $TAG_VERSION"
43+
44+
- name: Verify version matches tag
45+
run: |
46+
if [ "${{ steps.get_version.outputs.project_version }}" != "${{ steps.get_tag.outputs.tag_version }}" ]; then
47+
echo "ERROR: Tag version (${{ steps.get_tag.outputs.tag_version }}) doesn't match project version (${{ steps.get_version.outputs.project_version }})"
48+
echo "Please ensure your git tag matches the version in pyproject.toml [project] section"
49+
exit 1
50+
fi
51+
echo "Version verification passed"
52+
53+
- name: Install dependencies
54+
run: poetry install --only-root
55+
56+
- name: Build package
57+
run: poetry build
58+
59+
- name: Verify build contents
60+
run: |
61+
echo "Built packages:"
62+
ls -la dist/
63+
echo "Checking wheel contents:"
64+
python -m zipfile -l dist/*.whl | head -20
65+
66+
- name: Publish to PyPI
67+
run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
68+
69+
- name: Verify publication
70+
run: |
71+
echo "🎉 Successfully published lightning-pose v${{ steps.get_version.outputs.project_version }} to PyPI!"
72+
echo "Package should be available at: https://pypi.org/project/lightning-pose/${{ steps.get_version.outputs.project_version }}/"

.github/workflows/run-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ jobs:
3838
# -t flag is necessary to forward github cancellation event (SIGINT)
3939
run: |
4040
ssh -tt -p 55 ks3582@axon-remote.rc.zi.columbia.edu 'sh buildbot/build_srun.sh ${{ github.event.pull_request.number }}'
41-

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[project]
66
name = "lightning-pose"
7-
version = "1.9.0" # Update the version according to your source
7+
version = "1.9.1"
88
description = "Semi-supervised pose estimation using pytorch lightning"
99
license = "MIT"
1010
readme = "README.md"

0 commit comments

Comments
 (0)