Release #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release (Safe Testing Version) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump_type: | |
| description: 'Version bump type' | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| - pre | |
| changelog: | |
| description: 'Custom changelog entry (optional)' | |
| required: false | |
| type: string | |
| dry_run: | |
| description: 'Dry run (no PR creation)' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| prepare-release: | |
| name: Prepare Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.bump.outputs.version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Configure git | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Get current version | |
| id: current | |
| run: | | |
| VERSION=$(grep -m1 -oP '^version = "\K[^"]+' pyproject.toml) | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Current version: $VERSION" | |
| - name: Test version bump | |
| id: bump | |
| run: | | |
| # Make script executable | |
| chmod +x scripts/bump_version.py | |
| if [ "${{ github.event.inputs.dry_run }}" != "true" ]; then | |
| echo "=== ACTUAL VERSION BUMP ===" | |
| if [ -n "${{ github.event.inputs.changelog }}" ]; then | |
| python scripts/bump_version.py ${{ github.event.inputs.bump_type }} \ | |
| --changelog "${{ github.event.inputs.changelog }}" | |
| else | |
| python scripts/bump_version.py ${{ github.event.inputs.bump_type }} | |
| fi | |
| uv lock --no-progress || echo "Note: uv.lock update failed" | |
| NEW_VERSION=$(grep -m1 -oP '^version = "\K[^"]+' pyproject.toml) | |
| echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "New version: $NEW_VERSION" | |
| else | |
| echo "DRY RUN - No changes made" | |
| echo "version=$VERSION-dryrun" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create release branch and PR | |
| if: github.event.inputs.dry_run != 'true' | |
| run: | | |
| BRANCH_NAME="release/v${{ steps.bump.outputs.version }}" | |
| git checkout -b $BRANCH_NAME | |
| git add -A | |
| git commit -m "chore: bump version to ${{ steps.bump.outputs.version }} | |
| Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>" | |
| git push origin $BRANCH_NAME | |
| # Create PR using GitHub CLI | |
| gh pr create \ | |
| --base main \ | |
| --head $BRANCH_NAME \ | |
| --title "Release v${{ steps.bump.outputs.version }}" \ | |
| --body "## 🚀 Release v${{ steps.bump.outputs.version }} | |
| ### ⚠️ TESTING MODE | |
| This workflow is running in testing mode with PyPI publishing disabled. | |
| ### Changes | |
| - Version bumped from ${{ steps.current.outputs.version }} to ${{ steps.bump.outputs.version }} | |
| - Updated CHANGELOG.md | |
| ### Testing Checklist | |
| - [ ] Version bump is correct | |
| - [ ] CHANGELOG.md looks good | |
| - [ ] All files updated properly | |
| - [ ] PR created successfully | |
| ### Next Steps | |
| 1. Review this PR but DO NOT MERGE if just testing | |
| 2. Close this PR after verification | |
| 3. Once comfortable, enable PyPI publishing in workflow | |
| --- | |
| *Triggered by @${{ github.actor }}*" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Summary | |
| run: | | |
| echo "## Release Preparation Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then | |
| echo "✅ **DRY RUN COMPLETED**" >> $GITHUB_STEP_SUMMARY | |
| echo "No changes were made" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "✅ **Release PR Created**" >> $GITHUB_STEP_SUMMARY | |
| echo "- Previous version: ${{ steps.current.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- New version: ${{ steps.bump.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Branch: release/v${{ steps.bump.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Note:** PyPI publishing is currently disabled for testing" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| test-and-build: | |
| name: Test and Build | |
| needs: prepare-release | |
| if: github.event.inputs.dry_run != 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: release/v${{ needs.prepare-release.outputs.version }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| - name: Setup build environment | |
| run: | | |
| # Create virtual environment | |
| uv venv | |
| # Install build dependencies | |
| source .venv/bin/activate | |
| uv pip install build twine | |
| - name: Build and check package | |
| run: | | |
| # Ensure we're in the venv | |
| source .venv/bin/activate | |
| # Build the package | |
| uv build | |
| # Check with twine | |
| twine check dist/* | |
| # Show package contents | |
| echo "=== Package contents ===" | |
| python -m zipfile -l dist/*.whl | head -20 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish-testpypi: | |
| name: Publish to TestPyPI | |
| needs: test-and-build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: test-pypi | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| skip-existing: true | |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} |