-
Notifications
You must be signed in to change notification settings - Fork 1
fix: use draft releases to support immutable release policy #429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0a99467
fix: use draft releases to support immutable release policy
Aureliolo b2697e8
fix: address 8 review findings from zizmor, Greptile, CodeRabbit, Gemini
Aureliolo f4ab916
ci: suppress zizmor dangerous-triggers for finalize-release
Aureliolo ab632ff
fix: critical workflow fixes from round 2 review
Aureliolo 1b691fd
fix: harden finalize-release security guards (CodeRabbit round 3)
Aureliolo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: Finalize Release | ||
|
|
||
| # Publish draft releases once both CLI and Docker workflows succeed. | ||
| # Release Please creates draft releases (immutable once published), | ||
| # then CLI (GoReleaser) and Docker (GHCR) attach assets to the draft. | ||
| # This workflow fires on each completion and publishes when both are done. | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: [Docker, CLI] | ||
| types: [completed] | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Publish Draft Release | ||
| # Only process tag-triggered runs (release builds) | ||
| if: startsWith(github.event.workflow_run.head_branch, 'v') | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Check both workflows and publish draft | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| TAG: ${{ github.event.workflow_run.head_branch }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| echo "Triggered by: ${{ github.event.workflow.name }}" | ||
| echo "Tag: $TAG" | ||
| echo "Triggering run conclusion: ${{ github.event.workflow_run.conclusion }}" | ||
|
|
||
| # If the triggering workflow failed, no point checking the other | ||
| if [ "${{ github.event.workflow_run.conclusion }}" != "success" ]; then | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| echo "Triggering workflow failed — skipping." | ||
| exit 0 | ||
| fi | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Check status of both workflows for this tag. | ||
| # gh run list --branch works for both branches and tags. | ||
| CLI_CONCLUSION=$(gh run list --repo "$GITHUB_REPOSITORY" \ | ||
| --workflow cli.yml --branch "$TAG" --limit 1 \ | ||
| --json conclusion --jq '.[0].conclusion // "pending"') | ||
|
|
||
| DOCKER_CONCLUSION=$(gh run list --repo "$GITHUB_REPOSITORY" \ | ||
| --workflow docker.yml --branch "$TAG" --limit 1 \ | ||
| --json conclusion --jq '.[0].conclusion // "pending"') | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
|
|
||
| echo "CLI: $CLI_CONCLUSION" | ||
| echo "Docker: $DOCKER_CONCLUSION" | ||
|
|
||
| if [ "$CLI_CONCLUSION" != "success" ] || [ "$DOCKER_CONCLUSION" != "success" ]; then | ||
| echo "Not all workflows succeeded yet (CLI=$CLI_CONCLUSION, Docker=$DOCKER_CONCLUSION)." | ||
| echo "The other workflow's completion will trigger another attempt." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Both succeeded — check if release is still a draft | ||
| IS_DRAFT=$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" \ | ||
| --json isDraft --jq '.isDraft') | ||
|
|
||
| if [ "$IS_DRAFT" != "true" ]; then | ||
| echo "Release $TAG is not a draft (isDraft=$IS_DRAFT). Already published or not found." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Publish the draft release (makes it immutable) | ||
| gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --draft=false | ||
|
greptile-apps[bot] marked this conversation as resolved.
Outdated
|
||
| echo "Release $TAG published successfully." | ||
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -272,7 +272,8 @@ site/ # Astro landing page (synthorg.io) | |||||
| - **DAST**: `.github/workflows/dast.yml` — ZAP API scan against the backend OpenAPI spec on push to main + weekly schedule. Builds backend image locally, starts container, runs ZAP. Results available as workflow artifacts (no SARIF — action v0.10.0 lacks native SARIF output). Not on PRs (too slow). | ||||||
| - **Socket.dev**: GitHub App — supply chain attack detection on PRs (typosquatting, malware, suspicious ownership changes, obfuscated code). No config file needed, auto-comments on PRs. | ||||||
| - **CLA**: `.github/workflows/cla.yml` — Contributor License Agreement signature check on PRs via `contributor-assistant/github-action`. Triggers on `pull_request_target` and `issue_comment`. Skips Dependabot. Signatures stored in `.github/cla-signatures.json` on the `cla-signatures` branch (unprotected, so the action can commit directly). | ||||||
| - **Release**: `.github/workflows/release.yml` — Release Please (Google) auto-creates a release PR on every push to main. Merging the release PR creates a git tag (`vX.Y.Z`) + GitHub Release with changelog. Tag push triggers the Docker workflow to build version-tagged images. Uses `RELEASE_PLEASE_TOKEN` secret (PAT/GitHub App token) so tag creation triggers downstream workflows (GITHUB_TOKEN cannot). Config in `.github/release-please-config.json` and `.github/.release-please-manifest.json`. After creating/updating a release PR, auto-updates the BSL Change Date in LICENSE to 3 years ahead. | ||||||
| - **Release**: `.github/workflows/release.yml` — Release Please (Google) auto-creates a release PR on every push to main. Merging the release PR creates a git tag (`vX.Y.Z`) + **draft** GitHub Release with changelog. Tag push triggers Docker and CLI workflows to attach assets to the draft. Uses `RELEASE_PLEASE_TOKEN` secret (PAT/GitHub App token) so tag creation triggers downstream workflows (GITHUB_TOKEN cannot). Config in `.github/release-please-config.json` (`"draft": true`) and `.github/.release-please-manifest.json`. After creating/updating a release PR, auto-updates the BSL Change Date in LICENSE to 3 years ahead. | ||||||
| - **Finalize Release**: `.github/workflows/finalize-release.yml` — publishes draft releases after both Docker and CLI workflows succeed. Triggers on `workflow_run` completion of Docker and CLI. Checks both workflow conclusions for the tag, publishes the draft only when both are successful. Immutable releases are enabled on the repo — once published, release assets and body cannot be modified. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description of the 'Finalize Release' workflow logic could be clearer. To help developers quickly understand this critical new part of the release process, consider rephrasing it for better flow and clarity. The current wording is a bit repetitive and ambiguous.
Suggested change
|
||||||
|
|
||||||
| ## Dependencies | ||||||
|
|
||||||
|
|
||||||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.