feat(release): name the stable CDN pull request after its version

- push the stable channel to sync/stable-v<version> instead of a branch named after the time, a new sync of the same version updates its pull request
- close the open sync pull requests of older stable versions as superseded
- name the commit and the pull request after the version change, like the upstream check of peakimages/sqlite, with a note to squash merge it
This commit is contained in:
peaklabs-dev committed 2026-11-02 21:55:04 +01:00
1 parent 33c0f6e571
commit fa128d86c9
2 files changed
+33 -10

No files matched your search

+1
View File
@@ -169,6 +169,7 @@ The pull request workflow builds every pull request and publishes the image of a
| `nightly` | `/coolify/nightly/` | the nightly workflow after every nightly, pushed to main | | `nightly` | `/coolify/nightly/` | the nightly workflow after every nightly, pushed to main |
- The preview channel takes betas and release candidates, alphas reach the nightly channel only - The preview channel takes betas and release candidates, alphas reach the nightly channel only
- The stable channel opens a pull request from `sync/stable-v<version>`, squash merge it. A new sync of the same version updates it, a sync of a newer version closes it
- `CDN_TOKEN` in the environment `release` is a fine-grained token for `coollabsio/coollabs-cdn` alone, with read and write access to contents and pull requests - `CDN_TOKEN` in the environment `release` is a fine-grained token for `coollabsio/coollabs-cdn` alone, with read and write access to contents and pull requests
- `/coolify/versions.json` has a `stable`, `preview` and `nightly` block, each with the Coolify version of its channel and the helper, Sentinel and Traefik versions of the `upstream.json` it was synced from. An instance takes the newest version of its channel and the more stable ones - `/coolify/versions.json` has a `stable`, `preview` and `nightly` block, each with the Coolify version of its channel and the helper, Sentinel and Traefik versions of the `upstream.json` it was synced from. An instance takes the newest version of its channel and the more stable ones
- Every stable sync also sets the `coolify` and `traefik` keys, which older instances read, to the stable versions, so older instances upgrade to a version that reads the blocks - Every stable sync also sets the `coolify` and `traefik` keys, which older instances read, to the stable versions, so older instances upgrade to a version that reads the blocks
+32 -10
View File
@@ -73,7 +73,7 @@ write_versions() {
} }
commit_channel() { commit_channel() {
local name count local name count previous
mkdir -p "$WORK_DIR/cdn/$channel_path" mkdir -p "$WORK_DIR/cdn/$channel_path"
for name in ${FILES//,/ }; do for name in ${FILES//,/ }; do
channel_file "$name" > "$WORK_DIR/cdn/$channel_path/$name" channel_file "$name" > "$WORK_DIR/cdn/$channel_path/$name"
@@ -86,26 +86,48 @@ commit_channel() {
ok "$channel_path on $CDN_REPOSITORY is up to date" ok "$channel_path on $CDN_REPOSITORY is up to date"
exit 0 exit 0
fi fi
title="chore: sync the $channel channel to Coolify $VERSION" previous="$(cdn show HEAD:json/coolify/versions.json 2> /dev/null | jq -r --arg channel "$channel" '.[$channel].coolify.version // if $channel == "stable" then .coolify.v4.version else empty end' || true)"
version_change="${previous:+from Coolify v$previous to v$VERSION}"
version_change="${version_change:-to Coolify v$VERSION}"
title="chore: sync the $channel channel $version_change"
count="$(cdn diff --cached --name-only | wc -l | tr -d ' ')" count="$(cdn diff --cached --name-only | wc -l | tr -d ' ')"
cdn commit --quiet --message "$title" cdn commit --quiet --message "$title"
ok "committed $count changed file(s) of $channel_path" ok "committed $count changed file(s) of $channel_path"
} }
publish_channel() { publish_channel() {
local previous from branch pull_request local branch pull_request
if [ "$channel" != stable ]; then if [ "$channel" != stable ]; then
cdn push --quiet origin HEAD:main cdn push --quiet origin HEAD:main
ok "pushed the $channel channel to main of $CDN_REPOSITORY" ok "pushed the $channel channel to main of $CDN_REPOSITORY"
return return
fi fi
previous="$(cdn show HEAD~1:json/coolify/versions.json 2> /dev/null | jq -r '.stable.coolify.version // .coolify.v4.version // empty' || true)" cat > "$WORK_DIR/body.md" <<-BODY
[ "$previous" = "$VERSION" ] || from="${previous:+from Coolify $previous to }" Syncs the stable channel to Coolify v$VERSION, see its [release notes](https://github.com/coollabsio/coolify/releases/tag/v$VERSION).
branch="sync/stable-$(date -u +%Y%m%d%H%M%S)"
cdn push --quiet origin "HEAD:refs/heads/$branch" ## Changes
pull_request="$(gh pr create --repo "$CDN_REPOSITORY" --base main --head "$branch" --title "$title" \
--body "Syncs the stable channel ${from:-to Coolify }$VERSION, see the [release notes](https://github.com/coollabsio/coolify/releases/tag/v$VERSION).")" - Sync the stable channel $version_change
ok "opened $pull_request"
> [!IMPORTANT]
> Squash merge this PR to keep the commit history clean.
BODY
branch="sync/stable-v$VERSION"
cdn push --quiet --force origin "HEAD:refs/heads/$branch"
pull_request="$(gh pr list --repo "$CDN_REPOSITORY" --head "$branch" --state open --json url --jq '.[0].url // empty')"
if [ -n "$pull_request" ]; then
gh pr edit "$pull_request" --repo "$CDN_REPOSITORY" --title "$title" --body-file "$WORK_DIR/body.md" > /dev/null
ok "updated $pull_request"
else
pull_request="$(gh pr create --repo "$CDN_REPOSITORY" --base main --head "$branch" --title "$title" --body-file "$WORK_DIR/body.md")"
ok "opened $pull_request"
fi
gh pr list --repo "$CDN_REPOSITORY" --state open --json headRefName,url \
| jq -r --arg branch "$branch" '.[] | select((.headRefName | startswith("sync/stable-")) and .headRefName != $branch) | .url' \
| while read -r superseded; do
gh pr close "$superseded" --repo "$CDN_REPOSITORY" --delete-branch --comment "Superseded by $pull_request" > /dev/null
ok "closed $superseded, superseded by $pull_request"
done
info "Cloudflare keeps the old files for up to 10 minutes, scripts/sync-cdn.sh --purge clears them once this pull request is merged and deployed" info "Cloudflare keeps the old files for up to 10 minutes, scripts/sync-cdn.sh --purge clears them once this pull request is merged and deployed"
} }