Release Please #516
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 | |
| on: | |
| workflow_run: | |
| workflows: [CI] | |
| types: [completed] | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: release-please-main | |
| cancel-in-progress: false | |
| permissions: | |
| actions: write | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| name: Update or create the release | |
| if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - id: validated-head | |
| name: Require CI for the current main head | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| VALIDATED_SHA: ${{ github.event.workflow_run.head_sha }} | |
| run: | | |
| current=true | |
| if [ "$EVENT_NAME" = "workflow_run" ]; then | |
| main_sha=$( | |
| gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/main" \ | |
| --jq '.object.sha' | |
| ) | |
| if [ "$VALIDATED_SHA" != "$main_sha" ]; then | |
| current=false | |
| echo "Skipping stale CI result for \`$VALIDATED_SHA\`; current main is \`$main_sha\`." \ | |
| >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| fi | |
| echo "current=$current" >> "$GITHUB_OUTPUT" | |
| - if: steps.validated-head.outputs.current == 'true' | |
| uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1 | |
| id: release | |
| - if: steps.validated-head.outputs.current == 'true' && steps.release.outputs.prs_created == 'true' | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: release-please--branches--main--components--jacobian | |
| fetch-depth: 0 | |
| - if: steps.validated-head.outputs.current == 'true' && steps.release.outputs.prs_created == 'true' | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.12" | |
| - if: steps.validated-head.outputs.current == 'true' && steps.release.outputs.prs_created == 'true' | |
| uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 | |
| with: | |
| version: "0.11.28" | |
| enable-cache: false | |
| - if: steps.validated-head.outputs.current == 'true' && steps.release.outputs.prs_created == 'true' | |
| name: Synchronize release lockfile | |
| env: | |
| RELEASE_BRANCH: release-please--branches--main--components--jacobian | |
| run: | | |
| uv lock | |
| unexpected_files="$(git diff --name-only | grep -v '^uv\.lock$' || true)" | |
| if [[ -n "$unexpected_files" ]]; then | |
| echo "uv lock changed unexpected files:" >&2 | |
| echo "$unexpected_files" >&2 | |
| git diff >&2 | |
| exit 1 | |
| fi | |
| if git diff --quiet -- uv.lock; then | |
| echo "uv.lock is already synchronized" | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add uv.lock | |
| git commit -m "chore(release): synchronize uv lock" | |
| git push origin "HEAD:$RELEASE_BRANCH" | |
| - name: Dispatch release publishing | |
| if: steps.release.outputs.release_created == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| RELEASE_TAG: ${{ steps.release.outputs.tag_name }} | |
| run: >- | |
| gh workflow run release.yml | |
| --repo "$GITHUB_REPOSITORY" | |
| --ref main | |
| --field tag="$RELEASE_TAG" |