Automate release tagging via deploy key + self-pin bump - #638
Automate release tagging via deploy key + self-pin bump#638MaddyMicrosoft wants to merge 9 commits into
Conversation
Use the release deploy key (SSH) for git operations in release.yml and rollback.yml so branch/tag pushes bypass the tag protection rulesets and trigger the CI / live-test workflows, which GITHUB_TOKEN pushes do not. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add an open-selfpin-pr job that runs after a current-major release, rewrites the azure/login@<sha> self-references in the workflow files to the new release commit, pushes a chore/* branch, and opens a PR via GITHUB_TOKEN. Uses the default token (not the deploy key) since chore/* branches are unprotected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use the release deploy key (SSH) for git operations in release.yml and rollback.yml so branch/tag pushes bypass the tag protection rulesets and trigger the CI / live-test workflows, which GITHUB_TOKEN pushes do not. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add an open-selfpin-pr job that runs after a current-major release, rewrites the azure/login@<sha> self-references in the workflow files to the new release commit, pushes a chore/* branch, and opens a PR via GITHUB_TOKEN. Uses the default token (not the deploy key) since chore/* branches are unprotected. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The release workflow's open-selfpin-pr job bumps the azure/login self-reference pins on each release, so ignore azure/login in Dependabot to avoid duplicate bump PRs. Third-party actions remain covered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…/login into release-selfref-automation
Add a workflow that opens a GitHub issue on a routine 6-month cadence (Jan/Jul) reminding maintainers to rotate RELEASE_DEPLOY_KEY. Idempotent: skips if an open reminder issue already exists. Uses GITHUB_TOKEN (issues: write) only; wording is neutral for the public repo. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s release Without an explicit start tag, gh release create --generate-notes lets GitHub auto-select the previous tag and it can pick the floating major tag (v3), dumping the entire history into the notes (as happened for v3.0.2). Compute the previous vX.Y.Z tag via sort -V and pass --notes-start-tag, with an optional previous_version dispatch input as a manual override. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- release.yml: fail fast if the build did not produce lib/main/index.js and lib/cleanup/index.js, so a broken build can never be tagged as an (effectively immutable) release. - rollback.yml: add an open-selfpin-pr job mirroring release.yml, so a rollback also opens a PR repointing the azure/login self-references to the rolled-back version. Guarded to only act when the rollback target major matches master's currently pinned major (a back-major rollback is skipped). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The release workflow has a broken conditional argument expansion for --notes-start-tag, and the self-pin sed rewrite would break workflow YAML indentation (plus the reminder issue body will render as a code block due to leading spaces).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the release/rollback automation to use a repo-scoped deploy key for tag/branch pushes (to bypass tag rulesets where allowed), adds logic to make GitHub release notes diff against the correct prior semver tag, and introduces automation to keep this repo’s workflow self-pins (azure/login@<sha>) updated after each release.
Changes:
- Configure
actions/checkoutin release/rollback workflows to usessh-key: ${{ secrets.RELEASE_DEPLOY_KEY }}for tag/branch operations. - Add
previous_versioninput and compute a stable--notes-start-tagforgh release create. - Add a post-release job to open a PR that bumps workflow
azure/login@<sha>pins, plus Dependabot ignore + a scheduled key-rotation reminder workflow.
File summaries
| File | Description |
|---|---|
| .github/workflows/release.yml | Uses deploy key checkout for release pushes; adds previous_version handling; adds open-selfpin-pr automation job. |
| .github/workflows/rollback.yml | Uses deploy key checkout to force-move the major tag during rollback. |
| .github/workflows/deploy-key-rotation-reminder.yml | New scheduled workflow to open a periodic issue reminding admins to rotate the deploy key. |
| .github/dependabot.yml | Ignores azure/login GitHub Action updates to avoid duplicate self-pin bump PRs. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| for f in .github/workflows/*.yml .github/workflows/*.yaml; do | ||
| [ -e "$f" ] || continue | ||
| sed -i -E "s|(uses:[[:space:]]+azure/login@)[^[:space:]]+.*|\1${SHA} # ${V}|" "$f" | ||
| done |
| gh release create "$V" \ | ||
| --title "Azure Login Action $V" \ | ||
| --generate-notes | ||
| --generate-notes \ | ||
| ${PREV:+--notes-start-tag "$PREV"} |
| gh issue create --repo "$REPO" --title "$TITLE" --body 'Routine scheduled reminder to rotate the release deploy key (`RELEASE_DEPLOY_KEY`, on the `release` environment). This is a standard 6-month rotation, not an indication of any incident. | ||
|
|
||
| Rotation steps (requires repo admin; add the new key before removing the old one so there is no release downtime): | ||
|
|
||
| 1. Generate a new SSH keypair with an empty passphrase. | ||
| 2. Add the new public key as a **write** deploy key. | ||
| 3. Update the `RELEASE_DEPLOY_KEY` environment secret with the new private key. | ||
| 4. Delete the previous deploy key. | ||
| 5. Close this issue.' |
Summary
Automates release tagging via a repo-scoped deploy key (the one identity allowed to bypass the tag rulesets), keeps our
azure/login@<sha>self-references current after each release, and adds a rotation reminder.Changes
release.yml—checkoutusesssh-key: RELEASE_DEPLOY_KEY, so the release-branch push, version-tag create, andv3move go through the deploy key (needed to bypass the tag rulesets and to trigger downstream CI). Newopen-selfpin-prjob rewrites theazure/login@<sha>pins to the new release commit and opens achore/*PR (usesGITHUB_TOKEN, not the key).rollback.yml— samessh-keyaddition for thev3force-move.dependabot.yml— ignoresazure/login(now owned by the release workflow) to avoid duplicate bump PRs; third-party actions still covered.deploy-key-rotation-reminder.yml(new) — opens an issue every 6 months (Jan/Jul) to rotateRELEASE_DEPLOY_KEY; idempotent,issues: writeonly.Deploy key
Repo-scoped SSH key, git-only, no API access. Private key stored as an environment secret on
release(admin-gated). Only elevated power: bypasstags-create-blocked+major-tags-move-blocked. Not granted bypass on minor/delete rulesets; never writesmasteror opens PRs.Requires admin setup before functional
RELEASE_DEPLOY_KEYenv secret onrelease.tags-create-blocked+major-tags-move-blocked.releases/**write-once ruleset.Testing
Deploy-key push/bypass validated end-to-end in the
azclitools-actions-testsandbox (key push succeeds + triggers CI;GITHUB_TOKENblocked), then cleaned up. YAML validated locally.