Skip to content
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/nightly-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Nightly Build and Publish

on:
pull_request:
types:
- closed
schedule:
- cron: '0 0 * * *'

jobs:
nightly_bump_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Set up Python
run: uv python install 3.12
- name: Check for changes on main
id: changes
run: |
git fetch origin main
git log --since="24 hours ago" origin/main --oneline > changes.txt
if [ -s changes.txt ]; then echo "changed=true" >> $GITHUB_OUTPUT; else echo "changed=false" >> $GITHUB_OUTPUT; fi
- name: Bump patch version
if: steps.changes.outputs.changed == 'true'
run: |
python -c "
import toml
import re

# Read current version
with open('pyproject.toml', 'r') as f:
data = toml.load(f)

current_version = data['project']['version']
major, minor, patch = map(int, current_version.split('.'))

# Bump patch version
new_version = f'{major}.{minor}.{patch + 1}'
data['project']['version'] = new_version

# Write back
with open('pyproject.toml', 'w') as f:
toml.dump(data, f)

print(f'Bumped version from {current_version} to {new_version}')
"
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add pyproject.toml
git commit -m "ci: nightly patch bump"
git push
- name: Build
if: steps.changes.outputs.changed == 'true'
run: uv build
- name: Publish to TestPyPI
if: steps.changes.outputs.changed == 'true'
run: uv publish --repository testpypi