|
| 1 | +name: Release Please |
| 2 | + |
| 3 | +# Maintains the single release PR (VERSION bump + Communique-written |
| 4 | +# CHANGELOG section) and, when that PR merges, creates the tag + GitHub Release. |
| 5 | +# The stock release-please action cannot register a custom changelog generator, |
| 6 | +# so this workflow runs scripts/release-please-runner.js against the |
| 7 | +# release-please library and registers Communique there. |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + push: |
| 11 | + branches: |
| 12 | + - main |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: release-please-main |
| 16 | + cancel-in-progress: false |
| 17 | + |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + |
| 21 | +env: |
| 22 | + RELEASE_PLEASE_TARGET_BRANCH: main |
| 23 | + |
| 24 | +jobs: |
| 25 | + release-please: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + timeout-minutes: 20 |
| 28 | + permissions: |
| 29 | + contents: write |
| 30 | + issues: write |
| 31 | + pull-requests: write |
| 32 | + outputs: |
| 33 | + prs_created: ${{ steps.release_please.outputs.prs_created }} |
| 34 | + pr_branches: ${{ steps.release_please.outputs.pr_branches }} |
| 35 | + releases_created: ${{ steps.release_please.outputs.releases_created }} |
| 36 | + release_tags: ${{ steps.release_please.outputs.release_tags }} |
| 37 | + steps: |
| 38 | + - name: Check out main |
| 39 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 40 | + with: |
| 41 | + ref: ${{ env.RELEASE_PLEASE_TARGET_BRANCH }} |
| 42 | + fetch-depth: 0 |
| 43 | + persist-credentials: false |
| 44 | + |
| 45 | + # Install only the tools this release workflow needs. cache: false avoids |
| 46 | + # persisting tool downloads on a workflow that has write permissions and |
| 47 | + # release-note LLM secrets. |
| 48 | + - name: Set up mise |
| 49 | + uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1 |
| 50 | + with: |
| 51 | + install_args: node communique |
| 52 | + cache: false |
| 53 | + |
| 54 | + - name: Install locked Release Please dependency |
| 55 | + env: |
| 56 | + NPM_CONFIG_IGNORE_SCRIPTS: "true" |
| 57 | + run: npm ci --prefix scripts |
| 58 | + |
| 59 | + - name: Run release-please with Communique notes |
| 60 | + id: release_please |
| 61 | + env: |
| 62 | + GITHUB_TOKEN: ${{ github.token }} |
| 63 | + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
| 64 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 65 | + COMMUNIQUE_MODEL: ${{ vars.COMMUNIQUE_MODEL }} |
| 66 | + run: | |
| 67 | + set -euo pipefail |
| 68 | + ./scripts/run-release-please.sh |
| 69 | +
|
| 70 | + # Releases created with the workflow token do not trigger the |
| 71 | + # `release: published` workflow, so dispatch the Communique release-note |
| 72 | + # rewrite explicitly for each tag the runner created. |
| 73 | + dispatch-release-notes: |
| 74 | + runs-on: ubuntu-latest |
| 75 | + needs: release-please |
| 76 | + if: ${{ always() && !cancelled() && needs.release-please.outputs.releases_created == 'true' }} |
| 77 | + permissions: |
| 78 | + actions: write |
| 79 | + contents: read |
| 80 | + steps: |
| 81 | + - name: Dispatch Communique release notes for created releases |
| 82 | + env: |
| 83 | + GH_TOKEN: ${{ github.token }} |
| 84 | + RELEASE_TAGS: ${{ needs.release-please.outputs.release_tags }} |
| 85 | + run: | |
| 86 | + set -euo pipefail |
| 87 | + read -ra tags <<< "$RELEASE_TAGS" |
| 88 | + for tag in "${tags[@]}"; do |
| 89 | + gh workflow run release-notes.yaml --ref "$tag" --field "tag=$tag" |
| 90 | + done |
| 91 | +
|
| 92 | + # Branch pushes made with the workflow token do not trigger `pull_request` |
| 93 | + # workflows, so dispatch checks explicitly against the release PR branch head. |
| 94 | + dispatch-checks: |
| 95 | + runs-on: ubuntu-latest |
| 96 | + needs: release-please |
| 97 | + if: ${{ always() && !cancelled() && needs.release-please.outputs.prs_created == 'true' }} |
| 98 | + permissions: |
| 99 | + actions: write |
| 100 | + contents: read |
| 101 | + steps: |
| 102 | + - name: Dispatch checks onto the release PR branch |
| 103 | + env: |
| 104 | + GH_TOKEN: ${{ github.token }} |
| 105 | + PR_BRANCHES: ${{ needs.release-please.outputs.pr_branches }} |
| 106 | + run: | |
| 107 | + set -euo pipefail |
| 108 | + read -ra branches <<< "$PR_BRANCHES" |
| 109 | + for branch in "${branches[@]}"; do |
| 110 | + gh workflow run test.yml --ref "$branch" |
| 111 | + done |
0 commit comments