Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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}"
Expand Down
Loading