Skip to content

Commit 5f8d8f4

Browse files
gcampclaude
andauthored
GitHub Actions : python version + deploy workflow (#41)
* Convert project from pip to uv package manager - Replace setup.py with modern pyproject.toml configuration - Update installation instructions in README.md and CLAUDE.md to use uv sync - Update GitHub Actions workflow to use uv instead of pip - Add uv.lock file for reproducible dependency resolution - Update deployment process to use uv build 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Fix PR review issues for uv conversion - Move pytest and flake8 to development dependencies in pyproject.toml - Update GitHub Actions to use uv sync --extra dev instead of adding flake8 during CI - Update installation instructions to include dev dependencies - Verified package discovery pattern matches actual codebase structure 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Add global flake8 configuration to exclude build directories - Create .flake8 config file to exclude .venv, build, dist, and *.egg-info - Set max-line-length to 127 and max-complexity to 10 - Simplify GitHub Actions workflow to use global config instead of command-line flags - Remove tool.flake8 from pyproject.toml (flake8 doesn't support this format) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Update lock * Update GitHub Actions workflows - Update pull-request.yml to use .python-version file instead of hardcoded version - Add release.yml workflow for automatic deployment when version changes: - Detects version changes by comparing current version to last GitHub release - Runs tests before deployment - Publishes to PyPI using twine - Creates git tags and GitHub releases automatically 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
1 parent 6f4a1de commit 5f8d8f4

File tree

2 files changed

+102
-6
lines changed

2 files changed

+102
-6
lines changed

.github/workflows/pull-request.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@ on:
1212
jobs:
1313
build-and-test:
1414
runs-on: [ubuntu-latest]
15-
strategy:
16-
matrix:
17-
python-version: [pypy-3.10]
18-
1915
steps:
2016
- uses: actions/checkout@v2
21-
- name: Set up Python ${{ matrix.python-version }}
17+
- name: Set up Python
2218
uses: actions/setup-python@v2
2319
with:
24-
python-version: ${{ matrix.python-version }}
20+
python-version-file: '.python-version'
2521
- name: Install uv
2622
uses: astral-sh/setup-uv@v6
2723
- name: Install dependencies

.github/workflows/release.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release and Deploy
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
check-version:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
version-changed: ${{ steps.check.outputs.changed }}
12+
version: ${{ steps.version.outputs.version }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Get current version
17+
id: version
18+
run: |
19+
VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
20+
echo "version=$VERSION" >> $GITHUB_OUTPUT
21+
22+
- name: Check if version changed
23+
id: check
24+
env:
25+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
run: |
27+
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
28+
29+
# Get the last release version, or use 0.0.0 if no releases exist
30+
LAST_RELEASE_VERSION=$(gh release list --limit 1 --json tagName --jq '.[0].tagName // "v0.0.0"' | sed 's/^v//')
31+
32+
echo "Current version: $CURRENT_VERSION"
33+
echo "Last release version: $LAST_RELEASE_VERSION"
34+
35+
if [ "$CURRENT_VERSION" != "$LAST_RELEASE_VERSION" ]; then
36+
echo "changed=true" >> $GITHUB_OUTPUT
37+
echo "Version changed from $LAST_RELEASE_VERSION to $CURRENT_VERSION"
38+
else
39+
echo "changed=false" >> $GITHUB_OUTPUT
40+
echo "Version unchanged: $CURRENT_VERSION"
41+
fi
42+
43+
release:
44+
needs: check-version
45+
if: needs.check-version.outputs.version-changed == 'true'
46+
runs-on: ubuntu-latest
47+
permissions:
48+
contents: write
49+
id-token: write
50+
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Set up Python
55+
uses: actions/setup-python@v4
56+
with:
57+
python-version-file: '.python-version'
58+
59+
- name: Install uv
60+
uses: astral-sh/setup-uv@v6
61+
62+
- name: Install dependencies
63+
run: |
64+
sudo apt-get install libgeos-dev
65+
uv sync --extra dev
66+
67+
- name: Run tests
68+
run: |
69+
uv run python -m pytest .
70+
71+
- name: Build package
72+
run: |
73+
uv build
74+
75+
- name: Publish to PyPI
76+
uses: pypa/gh-action-pypi-publish@release/v1
77+
with:
78+
user: __token__
79+
password: ${{ secrets.PYPI_API_TOKEN }}
80+
81+
- name: Create Git tag
82+
run: |
83+
git config --local user.email "[email protected]"
84+
git config --local user.name "GitHub Action"
85+
git tag v${{ needs.check-version.outputs.version }}
86+
git push --tags
87+
88+
- name: Create GitHub Release
89+
uses: actions/create-release@v1
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
with:
93+
tag_name: v${{ needs.check-version.outputs.version }}
94+
release_name: Release v${{ needs.check-version.outputs.version }}
95+
body: |
96+
Release v${{ needs.check-version.outputs.version }}
97+
98+
This release was automatically created when the version was updated in pyproject.toml.
99+
draft: false
100+
prerelease: false

0 commit comments

Comments
 (0)