|
| 1 | +# Description: Cadenced patch bump for active cloud release branch(es). |
| 2 | +# |
| 3 | +# Why this exists: |
| 4 | +# New localization keys land on `main` and get backported to `cloud/x.y`, but |
| 5 | +# `i18n-update-core.yaml` only runs for version-bump PRs, and nothing was |
| 6 | +# driving version bumps on the cloud line on a cadence. A manual bump on the |
| 7 | +# cloud branch (e.g. #14066) was inert because it did not open a version-bump |
| 8 | +# PR that i18n would pick up. This workflow closes that gap: on a cadence it |
| 9 | +# dispatches the existing `release-version-bump.yaml` against the active cloud |
| 10 | +# branch, which opens a `version-bump-*` PR. `i18n-update-core.yaml` (now |
| 11 | +# allowed to run for `cloud/**` PRs) then regenerates translations for any new |
| 12 | +# backported keys and commits them INTO that same PR, so the patch bump and |
| 13 | +# the regenerated locale JSON merge to the cloud branch together as one |
| 14 | +# trackable "this was deployed" commit. lobe-i18n only translates missing |
| 15 | +# keys, so already-translated keys are never re-translated on later runs. |
| 16 | +# |
| 17 | +# Decision reference: #frontend-releases (Christian Byrne + Austin Mroz). |
| 18 | +# Companion change: `i18n-update-core.yaml` triggers on `cloud/**` PRs. |
| 19 | + |
| 20 | +name: 'Cloud Release: Patch Bump + i18n Regen' |
| 21 | + |
| 22 | +on: |
| 23 | + workflow_dispatch: |
| 24 | + inputs: |
| 25 | + branch: |
| 26 | + description: 'Cloud branch to bump (blank = auto-detect latest cloud/x.y)' |
| 27 | + required: false |
| 28 | + default: '' |
| 29 | + type: string |
| 30 | + force: |
| 31 | + description: 'Bump even if no new commits since the last version bump' |
| 32 | + required: false |
| 33 | + default: false |
| 34 | + type: boolean |
| 35 | + schedule: |
| 36 | + # Daily at 07:00 UTC. Offset from the main nightly bump (00:00 UTC) so the |
| 37 | + # two do not contend. Aligns roughly with the daily cloud backport deploys. |
| 38 | + - cron: '0 7 * * *' |
| 39 | + |
| 40 | +concurrency: |
| 41 | + group: cloud-release-version-bump |
| 42 | + cancel-in-progress: true |
| 43 | + |
| 44 | +permissions: |
| 45 | + contents: read |
| 46 | + |
| 47 | +jobs: |
| 48 | + bump-cloud: |
| 49 | + if: github.repository == 'Comfy-Org/ComfyUI_frontend' |
| 50 | + runs-on: ubuntu-latest |
| 51 | + env: |
| 52 | + # PAT so the dispatched release-version-bump run (and the PR it opens) |
| 53 | + # actually triggers downstream workflows; GITHUB_TOKEN-triggered events do |
| 54 | + # not start new workflow runs. |
| 55 | + GH_TOKEN: ${{ secrets.PR_GH_TOKEN }} |
| 56 | + steps: |
| 57 | + - name: Checkout repository |
| 58 | + uses: actions/checkout@v7 |
| 59 | + with: |
| 60 | + fetch-depth: 0 |
| 61 | + persist-credentials: false |
| 62 | + |
| 63 | + - name: Fetch cloud branches |
| 64 | + run: git fetch --no-tags origin '+refs/heads/cloud/*:refs/remotes/origin/cloud/*' |
| 65 | + |
| 66 | + - name: Resolve target branch(es) |
| 67 | + id: resolve |
| 68 | + env: |
| 69 | + INPUT_BRANCH: ${{ github.event.inputs.branch }} |
| 70 | + run: | |
| 71 | + set -euo pipefail |
| 72 | + if [[ -n "${INPUT_BRANCH:-}" ]]; then |
| 73 | + # Explicit override from workflow_dispatch. |
| 74 | + if ! [[ "$INPUT_BRANCH" =~ ^cloud/[0-9]+\.[0-9]+$ ]]; then |
| 75 | + echo "::error::Branch must match cloud/<major>.<minor>" |
| 76 | + exit 1 |
| 77 | + fi |
| 78 | + if ! git show-ref --verify --quiet "refs/remotes/origin/${INPUT_BRANCH}"; then |
| 79 | + echo "::error::Branch '${INPUT_BRANCH}' not found on origin" |
| 80 | + exit 1 |
| 81 | + fi |
| 82 | + BRANCHES="$INPUT_BRANCH" |
| 83 | + else |
| 84 | + # Auto-detect the newest cloud/x.y line. Older cloud branches are |
| 85 | + # EOL once a newer minor is cut, so only the latest is bumped. |
| 86 | + BRANCHES=$(git for-each-ref --format='%(refname:short)' 'refs/remotes/origin/cloud/*' \ |
| 87 | + | sed -n 's#^origin/\(cloud/[0-9]\+\.[0-9]\+\)$#\1#p' \ |
| 88 | + | sort -t/ -k2 -V \ |
| 89 | + | tail -n1) |
| 90 | + fi |
| 91 | + if [[ -z "$BRANCHES" ]]; then |
| 92 | + echo "::error::No active cloud/x.y branch found" |
| 93 | + exit 1 |
| 94 | + fi |
| 95 | + echo "Resolved cloud branch(es): $BRANCHES" |
| 96 | + { |
| 97 | + echo 'branches<<EOF' |
| 98 | + echo "$BRANCHES" |
| 99 | + echo 'EOF' |
| 100 | + } >> "$GITHUB_OUTPUT" |
| 101 | +
|
| 102 | + - name: Dispatch patch bump for each active cloud branch |
| 103 | + env: |
| 104 | + BRANCHES: ${{ steps.resolve.outputs.branches }} |
| 105 | + FORCE: ${{ github.event.inputs.force }} |
| 106 | + run: | |
| 107 | + set -euo pipefail |
| 108 | + while IFS= read -r BRANCH; do |
| 109 | + [[ -z "$BRANCH" ]] && continue |
| 110 | +
|
| 111 | + # Idempotency gate A: never stack a second bump PR on a branch that |
| 112 | + # already has one open and awaiting merge. |
| 113 | + OPEN=$(gh pr list --repo "$GITHUB_REPOSITORY" --base "$BRANCH" \ |
| 114 | + --state open --limit 1000 --json headRefName \ |
| 115 | + --jq '[.[] | select(.headRefName | startswith("version-bump-"))] | length') |
| 116 | + if [[ "$OPEN" -gt 0 ]]; then |
| 117 | + echo "⏭️ $BRANCH: a version-bump PR is already open; skipping." |
| 118 | + continue |
| 119 | + fi |
| 120 | +
|
| 121 | + # Idempotency gate B: skip when nothing merged since the last bump, |
| 122 | + # so quiet days do not churn empty patch bumps. `force` overrides. |
| 123 | + # If the last bump commit can't be found, proceed (fail open so we |
| 124 | + # never silently stop regenerating translations). |
| 125 | + LAST_BUMP=$(git log -1 --format='%H' -G'"version":' "origin/$BRANCH" -- package.json || true) |
| 126 | + if [[ "${FORCE:-false}" != "true" && -n "$LAST_BUMP" ]]; then |
| 127 | + NEW=$(git rev-list --count "$LAST_BUMP..origin/$BRANCH") |
| 128 | + if [[ "$NEW" -eq 0 ]]; then |
| 129 | + echo "⏭️ $BRANCH: no new commits since last bump; skipping." |
| 130 | + continue |
| 131 | + fi |
| 132 | + echo "ℹ️ $BRANCH: $NEW commit(s) since last bump." |
| 133 | + fi |
| 134 | +
|
| 135 | + # Dispatch the main definition of release-version-bump (it checks out |
| 136 | + # and bumps the `branch` input); do NOT run the cloud branch's older |
| 137 | + # copy, which predates the `branch` input. |
| 138 | + echo "🚀 $BRANCH: dispatching patch bump." |
| 139 | + gh workflow run release-version-bump.yaml \ |
| 140 | + --repo "$GITHUB_REPOSITORY" \ |
| 141 | + --ref main \ |
| 142 | + -f version_type=patch \ |
| 143 | + -f branch="$BRANCH" |
| 144 | + done <<< "$BRANCHES" |
0 commit comments