|
| 1 | +# CAMARA Release Automation — Caller Workflow |
| 2 | +# |
| 3 | +# Installed in API repositories by the CAMARA onboarding campaign |
| 4 | +# (camaraproject/project-administration). No modification needed; |
| 5 | +# all configuration is centralized in camaraproject/tooling. |
| 6 | +# |
| 7 | +# Triggers: |
| 8 | +# - Slash commands: /create-snapshot, /discard-snapshot, /delete-draft, /publish-release |
| 9 | +# - Issue events: close (with auto-reopen), reopen |
| 10 | +# - PR merge: on release-snapshot branches (creates draft release) |
| 11 | +# - Push to main: on release-plan.yaml, code/common/**, or this caller |
| 12 | +# workflow itself. All three paths end up running sync-issue so the |
| 13 | +# Release Issue body reflects the current repo state — most notably, |
| 14 | +# pushing to code/common/** (typically after a sync PR merge) refreshes |
| 15 | +# the common-cache status in the Release Issue and clears any stale warning. |
| 16 | +# - Manual: workflow_dispatch triggers sync-issue (reads from release-plan.yaml) |
| 17 | + |
| 18 | +name: CAMARA Release Automation |
| 19 | + |
| 20 | +on: |
| 21 | + # Slash commands via issue comments |
| 22 | + issue_comment: |
| 23 | + types: [created] |
| 24 | + |
| 25 | + # Issue close/reopen events |
| 26 | + issues: |
| 27 | + types: [closed, reopened] |
| 28 | + |
| 29 | + # PR merge to snapshot branches |
| 30 | + pull_request: |
| 31 | + types: [closed] |
| 32 | + branches: |
| 33 | + - 'release-snapshot/**' |
| 34 | + |
| 35 | + # Push to main with release-plan.yaml, common file, or caller workflow changes. |
| 36 | + # Listing the caller itself as a path ensures the workflow runs once right |
| 37 | + # after it is merged (future caller updates pick up their own trigger). |
| 38 | + push: |
| 39 | + branches: [main] |
| 40 | + paths: |
| 41 | + - 'release-plan.yaml' |
| 42 | + - 'code/common/**' |
| 43 | + - '.github/workflows/release-automation.yml' |
| 44 | + |
| 45 | + # Manual trigger for sync-issue only |
| 46 | + # Use this for: initial setup, recovery after manual repo changes, or forced sync |
| 47 | + # All other commands must be issued via slash commands in the Release Issue |
| 48 | + # Future: will accept branch input (main by default, maintenance branches as option) |
| 49 | + workflow_dispatch: |
| 50 | + |
| 51 | +# Serialize release automation runs per repository. |
| 52 | +# Prevents race conditions from concurrent slash commands, issue events, PR merges, |
| 53 | +# and workflow_dispatch triggers. With cancel-in-progress: false, queued runs wait |
| 54 | +# for the current run to complete before starting. |
| 55 | +# Note: GitHub allows at most 1 running + 1 pending per concurrency group. |
| 56 | +# A third arrival replaces the pending run (acceptable — codeowners act carefully). |
| 57 | +concurrency: |
| 58 | + group: release-automation-${{ github.repository }} |
| 59 | + cancel-in-progress: false |
| 60 | + |
| 61 | +permissions: |
| 62 | + contents: write |
| 63 | + issues: write |
| 64 | + pull-requests: write |
| 65 | + id-token: write |
| 66 | + |
| 67 | +jobs: |
| 68 | + release-automation: |
| 69 | + # Skip if: |
| 70 | + # - issue_comment from the RA bot itself (its own replies, to prevent self-triggering) |
| 71 | + # - issue_comment but not a release command or not on a release issue |
| 72 | + # - issues event but not a release issue |
| 73 | + # - pull_request but not merged or not to a snapshot branch |
| 74 | + if: | |
| 75 | + (github.event_name == 'push') || |
| 76 | + github.event_name == 'workflow_dispatch' || |
| 77 | + (github.event_name == 'issue_comment' && |
| 78 | + github.event.comment.user.login != 'camara-release-automation[bot]' && |
| 79 | + contains(github.event.issue.labels.*.name, 'release-issue') && |
| 80 | + (startsWith(github.event.comment.body, '/create-snapshot') || |
| 81 | + startsWith(github.event.comment.body, '/discard-snapshot') || |
| 82 | + startsWith(github.event.comment.body, '/delete-draft') || |
| 83 | + startsWith(github.event.comment.body, '/publish-release') || |
| 84 | + startsWith(github.event.comment.body, '/sync-issue'))) || |
| 85 | + (github.event_name == 'issues' && |
| 86 | + contains(github.event.issue.labels.*.name, 'release-issue')) || |
| 87 | + (github.event_name == 'pull_request' && |
| 88 | + github.event.pull_request.merged == true && |
| 89 | + startsWith(github.event.pull_request.base.ref, 'release-snapshot/')) |
| 90 | +
|
| 91 | + uses: camaraproject/tooling/.github/workflows/release-automation-reusable.yml@v1-rc |
| 92 | + secrets: inherit |
0 commit comments