ci: split release from build#749
Conversation
📝 WalkthroughWalkthroughSwitched publish workflow to trigger on GitHub Changes
Sequence Diagram(s)sequenceDiagram
participant GH as "GitHub Actions"
participant Repo as "Repository (git)"
participant Discord as "Discord (reusable workflow)"
GH->>Repo: Trigger on release event (released)
GH->>Repo: Checkout using github.sha
GH->>GH: Build & tag images (tag = github.event.release.tag_name)
GH->>Repo: Fetch tags & compute previous v* tag (prepare-release-notification)
GH->>GH: Emit base_tag and compare_url
GH->>Discord: Invoke notify reusable workflow with tag, release URL, sha, base_tag, compare_url
Discord-->>GH: Return notification result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
f6460f9 to
1f1c445
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
.github/workflows/release-main.yml (2)
37-40:⚠️ Potential issue | 🔴 CriticalStale
semantic-releaseoutputs — the producing step was removed but theoutputs:block remains.Lines 37-40 still map
released/release_tag/release_shafromsteps.release_state.outputs.*, but theCapture Release Statestep (id: release_state) was removed from this job. These outputs will therefore always evaluate to empty strings, which silently breaks every downstream consumer — in particularbackport-releaseat lines 95 and 119-120.See the consolidated comment on
backport-releasebelow for the full impact and a proposed direction.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release-main.yml around lines 37 - 40, The outputs block still maps released, release_tag, and release_sha from steps.release_state.outputs.*, but the producing step (id: release_state) was removed so these will be empty and break consumers like the backport-release step; fix by either restoring the Capture Release State step with id release_state that sets those outputs or by removing the released/release_tag/release_sha entries from the job outputs and updating downstream references (e.g., the backport-release step) to use an alternative source; ensure references to steps.release_state and the three output names (released, release_tag, release_sha) are reconciled across the workflow.
93-134:⚠️ Potential issue | 🔴 Critical
backport-releaseis broken: staleif:, missing outputs, and reference to a removed job.After this PR, three compounding issues prevent this job from ever running successfully:
if:on line 95 references two things that no longer exist:
needs.semantic-release.outputs.released— always empty (see comment on lines 37-40; therelease_statestep was removed).needs.publish-release.result—publish-releaseis not inneeds(line 96) and has been moved topublish-release.yml(a different workflow, triggered by thereleaseevent). Cross-workflow job results are not accessible vianeeds.*.result. This sub-expression will never be'success'.Net effect: the condition is permanently false, so backport-to-develop is silently disabled on every release.
RELEASE_SHA/RELEASE_TAGon lines 119-120 would be empty strings even if theifwere fixed, sogit cherry-pick -x ""fails and${RELEASE_TAG#v}is empty.Even with outputs restored, gating on
publish-releasesuccess is no longer possible from this workflow. You likely need to either (a) movebackport-releaseintopublish-release.ymlso it can depend onbuild-and-release, or (b) keep it here but drop the cross-workflow gating and derive tag/sha fromgit describe/ the latestv*tag created bysemantic-release.🛠 Suggested direction (option A: move backport to the on-release workflow)
In
publish-release.yml, add a job that needsbuild-and-releaseand usesgithub.event.release.tag_name/github.shadirectly — no outputs required. Then deletebackport-releasefromrelease-main.yml.Option B (keep here) would look roughly like:
backport-release: name: Backport Release Commit to Develop - if: ${{ needs.semantic-release.outputs.released == 'true' && needs.publish-release.result == 'success' }} + if: ${{ needs.semantic-release.outputs.released == 'true' }} needs: [semantic-release]and restoring the
Capture Release Statestep (or equivalent) insemantic-releaseso the three outputs are populated again. Note this loses the prior guarantee that the image was published before backporting.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release-main.yml around lines 93 - 134, The backport-release job is disabled by a stale if condition and missing outputs; fix by either moving the backport-release job into the publish-release.yml workflow (so it can need build-and-release and read github.event.release.tag_name and github.sha directly) or, if you keep backport-release in this file, remove the broken if (the expression referencing needs.semantic-release.outputs.released and needs.publish-release.result) and instead derive RELEASE_TAG/RELEASE_SHA inside the job (e.g., use git fetch --tags && RELEASE_TAG="$(git describe --tags --abbrev=0 --match 'v*')" and RELEASE_SHA="$(git rev-list -n1 ${RELEASE_TAG})") before running git cherry-pick -x; ensure the job uses the backport-release name and that the environment vars RELEASE_TAG and RELEASE_SHA are set from these commands (or restore the release_state step to populate outputs if you prefer to gate on semantic-release outputs).
🧹 Nitpick comments (1)
.github/workflows/publish-release.yml (1)
92-105: Consider filtering pre-release tags and simplifying the fetch.Two minor points:
git fetch origin main --tags --force— themainrefspec and--forcearen't needed here; only tags are consumed.git fetch origin --tagswould suffice and avoids clobbering tags.git tag --sort=-version:refname 'v*'will also match pre-release tags such asv1.2.3-rc1/v2.0.0-beta.1. If you ever cut a stable release while a more recent RC tag exists, the "base" would be that RC andcompare_urlwould diff against the pre-release rather than the prior stable. If your release process can producev*pre-release tags, consider filtering them out (e.g.,grep -Ev '-(rc|alpha|beta)').🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/publish-release.yml around lines 92 - 105, Replace the fetch and tag-selection steps so we only fetch tags (remove the unnecessary "main" refspec and "--force") and filter out prerelease tags when computing BASE_TAG; specifically, change the "git fetch origin main --tags --force" usage to a simple "git fetch origin --tags" call and update the BASE_TAG pipeline that currently uses "git tag --sort=-version:refname 'v*' | grep -Fxv \"$RELEASE_TAG\" | head -n 1" to exclude prerelease patterns (e.g., pipe through a grep -Ev '-(rc|alpha|beta)' before removing $RELEASE_TAG) so the computed BASE_TAG is the latest stable release tag rather than a prerelease.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/publish-release.yml:
- Around line 52-56: The tags list in the publish-release workflow concatenates
the release tag without a colon (the entry "grimmory/grimmory${{
github.event.release.tag_name }}"), causing Docker to treat it as part of the
repository name; update that entry to include the tag separator so it reads
"grimmory/grimmory:${{ github.event.release.tag_name }}" to match the GHCR
format and ensure the image is published under the proper vX.Y.Z tag.
---
Outside diff comments:
In @.github/workflows/release-main.yml:
- Around line 37-40: The outputs block still maps released, release_tag, and
release_sha from steps.release_state.outputs.*, but the producing step (id:
release_state) was removed so these will be empty and break consumers like the
backport-release step; fix by either restoring the Capture Release State step
with id release_state that sets those outputs or by removing the
released/release_tag/release_sha entries from the job outputs and updating
downstream references (e.g., the backport-release step) to use an alternative
source; ensure references to steps.release_state and the three output names
(released, release_tag, release_sha) are reconciled across the workflow.
- Around line 93-134: The backport-release job is disabled by a stale if
condition and missing outputs; fix by either moving the backport-release job
into the publish-release.yml workflow (so it can need build-and-release and read
github.event.release.tag_name and github.sha directly) or, if you keep
backport-release in this file, remove the broken if (the expression referencing
needs.semantic-release.outputs.released and needs.publish-release.result) and
instead derive RELEASE_TAG/RELEASE_SHA inside the job (e.g., use git fetch
--tags && RELEASE_TAG="$(git describe --tags --abbrev=0 --match 'v*')" and
RELEASE_SHA="$(git rev-list -n1 ${RELEASE_TAG})") before running git cherry-pick
-x; ensure the job uses the backport-release name and that the environment vars
RELEASE_TAG and RELEASE_SHA are set from these commands (or restore the
release_state step to populate outputs if you prefer to gate on semantic-release
outputs).
---
Nitpick comments:
In @.github/workflows/publish-release.yml:
- Around line 92-105: Replace the fetch and tag-selection steps so we only fetch
tags (remove the unnecessary "main" refspec and "--force") and filter out
prerelease tags when computing BASE_TAG; specifically, change the "git fetch
origin main --tags --force" usage to a simple "git fetch origin --tags" call and
update the BASE_TAG pipeline that currently uses "git tag
--sort=-version:refname 'v*' | grep -Fxv \"$RELEASE_TAG\" | head -n 1" to
exclude prerelease patterns (e.g., pipe through a grep -Ev '-(rc|alpha|beta)'
before removing $RELEASE_TAG) so the computed BASE_TAG is the latest stable
release tag rather than a prerelease.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 86332db8-ea58-4a9f-af22-adb56f98eab8
📒 Files selected for processing (2)
.github/workflows/publish-release.yml.github/workflows/release-main.yml
📜 Review details
🔇 Additional comments (1)
.github/workflows/publish-release.yml (1)
107-123: Permissions are correctly set to empty. The reusable workflownotify-discord-release-notes.ymldoes not perform any GitHub-authenticated actions. Its two steps only compose a message and send it to Discord via webhook—neither requires GitHub API scopes. Thepermissions: {}in both the caller and callee is appropriate and intentional.> Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/release-main.yml:
- Around line 120-121: The if condition for the backport-release job references
a non-existent needs.publish-release.result, which always evaluates false
because publish-release was removed from the needs list; fix by updating the
backport-release job's condition (the `if:` that reads
needs.semantic-release.outputs.released == 'true' &&
needs.publish-release.result == 'success') to remove the stale
`needs.publish-release.result == 'success'` clause (or alternatively re-add
`publish-release` to the job's `needs:` list if that dependency is required),
ensuring the `backport-release` job only relies on the actual declared
dependencies (see the `if:` expression and the `needs:` array for the
backport-release job).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: d3dfbcde-e32d-42fa-a3b2-29e88c89b11a
📒 Files selected for processing (2)
.github/workflows/publish-release.yml.github/workflows/release-main.yml
🚧 Files skipped from review as they are similar to previous changes (1)
- .github/workflows/publish-release.yml
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/release-main.yml (1)
83-91:⚠️ Potential issue | 🔴 CriticalReleases created via
GITHUB_TOKENwill not triggerpublish-release.yml.With publish/notify jobs moved to
.github/workflows/publish-release.yml(which triggers onrelease: types: [released]), the entire stable build and Discord notification chain now depends on the GitHubreleaseevent firing downstream.When
RELEASE_BOT_TOKENis unset, the fallbackgithub.tokenis used. Per GitHub Actions docs, events triggered by the defaultGITHUB_TOKEN(other thanworkflow_dispatch/repository_dispatch) do not start new workflow runs. Result:semantic-releasepublishes the GitHub release, butpublish-release.ymlnever runs — no image is built, no Discord notification sent, and this failure is silent.Required safeguards:
- Fail fast in this workflow if
secrets.RELEASE_BOT_TOKENis empty. This is now a hard dependency, not a soft fallback, since the cross-workflow trigger is load-bearing.- Alternatively, add
workflow_dispatchtrigger topublish-release.ymlso a missing PAT doesn't silently skip the build/notify chain.Manual release creation via the GitHub UI is unaffected — that path is a user event and will trigger
publish-release.ymlcorrectly. The risk is strictly for semantic-release-driven releases onmain.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/release-main.yml around lines 83 - 91, The workflow currently falls back to GITHUB_TOKEN which cannot trigger downstream workflows; update the "Run semantic-release" step to fail fast when secrets.RELEASE_BOT_TOKEN is empty by adding a pre-check that exits non-zero if the secret is unset (i.e., verify secrets.RELEASE_BOT_TOKEN and stop the job instead of assigning GH_TOKEN/GITHUB_TOKEN fallback), and ensure the env for the step uses only RELEASE_BOT_TOKEN (GH_TOKEN/GITHUB_TOKEN should not be used as a fallback); alternatively, add a workflow_dispatch trigger to publish-release.yml so releases can be retriggered manually if the PAT is missing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In @.github/workflows/release-main.yml:
- Around line 83-91: The workflow currently falls back to GITHUB_TOKEN which
cannot trigger downstream workflows; update the "Run semantic-release" step to
fail fast when secrets.RELEASE_BOT_TOKEN is empty by adding a pre-check that
exits non-zero if the secret is unset (i.e., verify secrets.RELEASE_BOT_TOKEN
and stop the job instead of assigning GH_TOKEN/GITHUB_TOKEN fallback), and
ensure the env for the step uses only RELEASE_BOT_TOKEN (GH_TOKEN/GITHUB_TOKEN
should not be used as a fallback); alternatively, add a workflow_dispatch
trigger to publish-release.yml so releases can be retriggered manually if the
PAT is missing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 348438d7-119a-4cb2-954c-8b7d314d14dd
📒 Files selected for processing (1)
.github/workflows/release-main.yml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Test Suite / Frontend Tests
- GitHub Check: Test Suite / Backend Tests
- GitHub Check: Frontend Lint Threshold Check
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (java-kotlin)
- GitHub Check: Analyze (actions)
🔇 Additional comments (1)
.github/workflows/release-main.yml (1)
120-121: Stalepublish-releasegate is now removed — matches prior suggestion.
if:condition andneeds:are consistent;backport-releasewill now run on any successful release rather than being silently skipped.
Description
this moves the image build, notification, and the like to an on-release event rather
than as part of cutting the release via the
release-mainworkflowthis allows us to more safely work on the cutting of the release while still allowing for a path
for creating releases manually -- via github's release flow.
this also makes the on-release-publish workflow more similar to the on-nightly workflow
Changes
skip-cicheck - this is redundant with Github Actions featuresSummary by CodeRabbit