From 71db98771bf4ed3db6f2ac5292eb0f74d2d345e6 Mon Sep 17 00:00:00 2001 From: Brion Date: Wed, 21 Oct 2026 12:06:36 +0530 Subject: [PATCH] Stop concurrent sample releases from failing on push races Releasing many samples at once ran every matrix job's version-bump push against main together, and the fixed 3 to 12 second backoff gave up after five attempts, failing the Express, Vue and Flutter quickstart releases. Run at most four releases at a time and retry up to ten times with a randomized wait. Refs thunder-id/thunderid#5904 Signed-off-by: Brion --- .github/workflows/release.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a1dde56..2cf33b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ # Each selected sample is released independently: its version is bumped in its # native manifest (package.json, pubspec.yaml, build.gradle.kts, project.pbxproj), # committed, tagged, packed into a source zip and attached to a GitHub Release. -# Sample jobs run concurrently; push conflicts are handled by a retry-with-rebase +# Sample jobs run up to four at a time; push conflicts are handled by a retry-with-rebase # loop in the commit step. name: 🚀 Release @@ -166,6 +166,8 @@ jobs: runs-on: ubuntu-latest strategy: fail-fast: false + # Each release pushes to the same branch; a few at a time keeps those pushes from piling up. + max-parallel: 4 matrix: sample: ${{ fromJson(needs.validate.outputs.samples) }} env: @@ -191,11 +193,14 @@ jobs: git config user.email "${{ env.RELEASE_GIT_USER_EMAIL }}" git add "${{ steps.bump.outputs.manifest }}" git diff --cached --quiet || git commit -m "[Release] ${SAMPLE_PATH}@${VERSION}" - for i in $(seq 1 5); do + # Every selected sample pushes its own commit to the same branch at about the same time. + # A random wait between attempts stops the jobs that lost a race from retrying in step + # with each other, which a fixed backoff does not. + for i in $(seq 1 10); do git pull --rebase origin ${{ github.ref_name }} git push origin HEAD:${{ github.ref_name }} && break - [ "$i" -eq 5 ] && exit 1 - sleep $((i * 3)) + [ "$i" -eq 10 ] && exit 1 + sleep $((i + RANDOM % 10)) done git tag "sample/${SAMPLE_PATH}/v${VERSION}" git push origin "sample/${SAMPLE_PATH}/v${VERSION}"