|
| 1 | +name: Internal - Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + # checkov:skip=CKV_GHA_7: force only bypasses the no-changes guard; source and build settings stay fixed. |
| 6 | + inputs: |
| 7 | + force: |
| 8 | + description: Release even when no relevant changes are detected |
| 9 | + type: boolean |
| 10 | + required: false |
| 11 | + default: false |
| 12 | + |
| 13 | + schedule: |
| 14 | + - cron: "25 8 * * 1" |
| 15 | + |
| 16 | +permissions: {} |
| 17 | + |
| 18 | +concurrency: |
| 19 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 20 | + cancel-in-progress: false |
| 21 | + |
| 22 | +jobs: |
| 23 | + ci: |
| 24 | + if: github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch |
| 25 | + uses: $/.github/workflows/__shared-ci.yml |
| 26 | + permissions: |
| 27 | + actions: read |
| 28 | + attestations: write |
| 29 | + contents: read |
| 30 | + packages: write |
| 31 | + pull-requests: write |
| 32 | + id-token: write |
| 33 | + issues: write |
| 34 | + security-events: write |
| 35 | + statuses: write |
| 36 | + |
| 37 | + release: |
| 38 | + name: Create and publish release |
| 39 | + needs: ci |
| 40 | + runs-on: ubuntu-latest |
| 41 | + permissions: |
| 42 | + contents: read |
| 43 | + pull-requests: read |
| 44 | + steps: |
| 45 | + # Use the app token so publishing the tag triggers the main CI documentation jobs. |
| 46 | + - id: generate-token |
| 47 | + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 |
| 48 | + with: |
| 49 | + client-id: ${{ vars.CI_BOT_APP_CLIENT_ID }} |
| 50 | + private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env] CI bot authentication is required to trigger tag workflows |
| 51 | + permission-contents: write |
| 52 | + permission-pull-requests: read |
| 53 | + |
| 54 | + - name: Plan release |
| 55 | + id: plan-release |
| 56 | + uses: hoverkraft-tech/ci-github-publish/actions/release/plan@f06e0e72a76bfca57c34d08d03e5c1914275fd4c # 2.0.0 |
| 57 | + with: |
| 58 | + target-sha: ${{ github.sha }} |
| 59 | + github-token: ${{ steps.generate-token.outputs.token }} |
| 60 | + |
| 61 | + - name: Create and publish release |
| 62 | + if: (steps.plan-release.outputs.has-changes == 'true' || (github.event_name == 'workflow_dispatch' && inputs.force)) && steps.plan-release.outputs.tag != '' |
| 63 | + uses: hoverkraft-tech/ci-github-publish/actions/release/create@f06e0e72a76bfca57c34d08d03e5c1914275fd4c # 2.0.0 |
| 64 | + env: |
| 65 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} # zizmor: ignore[secrets-outside-env] repository secret is scoped to the release summary step |
| 66 | + with: |
| 67 | + tag: ${{ steps.plan-release.outputs.tag }} |
| 68 | + target-sha: ${{ github.sha }} |
| 69 | + publish: "true" |
| 70 | + changelog-summary: | |
| 71 | + { |
| 72 | + "llmAuth": ${{ toJSON(env.OPENAI_API_KEY) }}, |
| 73 | + "llmProvider": "openai" |
| 74 | + } |
| 75 | + github-token: ${{ steps.generate-token.outputs.token }} |
0 commit comments