Skip to content

Weekly PyPI Release #28

Weekly PyPI Release

Weekly PyPI Release #28

Workflow file for this run

name: "Weekly PyPI Release"
on:
# Run every Sunday at 2 AM UTC
schedule:
- cron: '0 2 * * 0'
# Allow manual triggering for testing
workflow_dispatch:
permissions:
contents: read
jobs:
publish-to-pypi:
runs-on: ubuntu-latest
steps:
- name: "Checkout devel branch"
uses: actions/checkout@v6
with:
ref: devel
- name: "Install uv"
uses: astral-sh/setup-uv@v7
- name: "Set up Python"
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: "Generate date-based version"
id: version
run: |
# Get current date in YYYYMMDD format
DATE_VERSION=$(date +%Y%m%d)
# Extract base version from setup.cfg (e.g., "0.7.0dev" -> "0.7.0")
BASE_VERSION=$(grep "version = " setup.cfg | cut -d' ' -f3 | sed 's/dev$//')
# Create new version (e.g., "0.7.20251111")
NEW_VERSION="${BASE_VERSION%.*}.${DATE_VERSION}"
echo "Original version: $(grep 'version = ' setup.cfg | cut -d' ' -f3)"
echo "New version: $NEW_VERSION"
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: "Update version temporarily for build"
run: |
# Create a temporary setup.cfg with the new version
sed "s/version = .*/version = ${{ steps.version.outputs.version }}/" setup.cfg > setup.cfg.tmp
mv setup.cfg.tmp setup.cfg
echo "Updated setup.cfg version to:"
grep "version = " setup.cfg
- name: "Install dependencies and build"
run: |
uv sync
uv build
- name: "Publish to PyPI"
env:
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
echo "Publishing to PyPI..."
uv publish
- name: "Summary"
run: |
echo "## PyPI Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version Published:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "**Date:** $(date)" >> $GITHUB_STEP_SUMMARY
echo "**Branch:** devel" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Package successfully published to PyPI!" >> $GITHUB_STEP_SUMMARY