fix: align tooling and CI with Python 3.12 #127
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-please | |
| # Automated releases from Conventional Commits. On each push to main, release- | |
| # please maintains a "chore: release X.Y.Z" PR (version bump + CHANGELOG). Merge | |
| # that PR to cut the release: it tags vX.Y.Z, creates the GitHub Release, and the | |
| # step below re-points the moving major tag (e.g. v1 -> v1.2.0). | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| release_as: | |
| description: 'Optional version to force, for example 1.10.0. Leave empty to use Conventional Commits.' | |
| type: string | |
| required: false | |
| force_release: | |
| description: 'Force a release workflow by creating one minimal fix commit when no release-worthy commits are detected.' | |
| type: boolean | |
| required: false | |
| default: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: googleapis/release-please-action@v4 | |
| id: release | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| release-as: ${{ inputs.release_as || '' }} | |
| - name: Create release trigger commit for manual forced release | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.force_release == true && steps.release.outputs.release_created == 'false' }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${{ inputs.release_as }}" ]; then | |
| echo "force_release requested, but release_as is required" >&2 | |
| exit 1 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git checkout main | |
| git reset --hard origin/main | |
| git commit --allow-empty -m "fix(action): trigger manual release ${{ inputs.release_as }}" | |
| git push origin HEAD:main | |
| # Move the moving major tag here rather than in release-major-tag.yml: a | |
| # release created with GITHUB_TOKEN does NOT trigger other workflows, so the | |
| # `release: published` listener wouldn't fire for release-please releases. | |
| - uses: actions/checkout@v4 | |
| if: ${{ steps.release.outputs.release_created }} | |
| with: | |
| fetch-depth: 0 | |
| - name: Update major tag | |
| if: ${{ steps.release.outputs.release_created }} | |
| env: | |
| TAG: ${{ steps.release.outputs.tag_name }} | |
| MAJOR: ${{ steps.release.outputs.major }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git tag -fa "v${MAJOR}" -m "v${MAJOR} -> ${TAG}" "${TAG}" | |
| git push origin "v${MAJOR}" --force |