chore(deps): Bump actions/setup-python from 2 to 6 #40
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 Python Package | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_name: | |
| description: "One of major, minor, or patch" | |
| required: true | |
| type: choice | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| default: patch | |
| pull_request: | |
| branches: | |
| - '**' | |
| env: | |
| UV_SYSTEM_PYTHON: 1 | |
| DEFAULT_VERSION_NAME: patch | |
| UV_PUBLISH_USERNAME: ${{ secrets.UV_PUBLISH_USERNAME }} | |
| UV_PUBLISH_PASSWORD: ${{ secrets.UV_PUBLISH_PASSWORD }} | |
| jobs: | |
| deploy-package: | |
| runs-on: ubuntu-latest | |
| name: ${{ github.event_name == 'pull_request' && '(Dry Run) ' || '' }}Publish Python Package to PyPI | |
| permissions: | |
| id-token: write | |
| contents: write | |
| defaults: | |
| run: | |
| shell: bash -l {0} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| - name: Setup Pixi Environment | |
| uses: prefix-dev/setup-pixi@v0.8.8 | |
| with: | |
| pixi-version: latest | |
| cache: true | |
| cache-write: ${{ github.event_name == 'push' }} | |
| - name: Set version name | |
| run: echo "VERSION_NAME=${{ github.event.inputs.version_name || env.DEFAULT_VERSION_NAME }}" >> $GITHUB_ENV | |
| - name: Dry run bump2version | |
| run: | | |
| uvx bump2version@latest --dry-run ${{ env.VERSION_NAME }} --allow-dirty --verbose | |
| - name: Store new version number | |
| run: echo "VERSION_NUMBER=`uvx bump2version@latest --dry-run --list ${{ env.VERSION_NAME }} | grep new_version | sed -r s,"^.*=",,`" >> $GITHUB_ENV | |
| - name: Display new version number | |
| run: | | |
| echo "VERSION_NAME: ${{ env.VERSION_NAME }}" | |
| echo "VERSION_NUMBER: v${{ env.VERSION_NUMBER }}" | |
| - name: Ensure repo status is clean | |
| run: git status | |
| - name: Configure Git | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| - name: Run bump2version | |
| run: uvx bump2version@latest ${{ env.VERSION_NAME }} --verbose | |
| - name: Ensure tag creation | |
| run: git tag | grep ${{ env.VERSION_NUMBER }} | |
| - name: Write release notes | |
| if: github.event_name != 'pull_request' | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| run: | | |
| uv tool install llamabot[cli] --python 3.12 --python-preference only-managed --force | |
| llamabot configure default-model --model-name "${{ secrets.DEFAULT_LANGUAGE_MODEL }}" | |
| llamabot git write-release-notes | |
| - name: Commit release notes | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| uv tool install pre-commit | |
| pre-commit run --all-files || pre-commit run --all-files | |
| git add . | |
| git commit -m "Add release notes for ${{ env.VERSION_NUMBER }}" | |
| - name: Build package | |
| run: | | |
| uv build --sdist --wheel | |
| - name: Publish package | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| uv publish --index ericmjl-personal-packages | |
| - name: Push changes with tags | |
| if: github.event_name != 'pull_request' | |
| run: | | |
| git push && git push --tags | |
| - name: Create release in GitHub repo | |
| if: github.event_name != 'pull_request' | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| bodyFile: "docs/releases/v${{ env.VERSION_NUMBER }}.md" | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag: v${{ env.VERSION_NUMBER }} | |
| - name: Ensure complete | |
| if: github.event_name != 'pull_request' | |
| run: echo "Auto-release complete!" |