Skip to content

Commit b9aad78

Browse files
ci(mobile): record store builds only after they are submitted
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a573a7d commit b9aad78

1 file changed

Lines changed: 38 additions & 60 deletions

File tree

‎.github/workflows/mobile-eas-production.yml‎

Lines changed: 38 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -626,40 +626,29 @@ jobs:
626626
exit 1
627627
fi
628628
629-
# Record before submitting: a build that can't be recorded is never
630-
# submitted, so the next merge's rebuild can't duplicate a store build.
631-
- id: tag
632-
name: Record build
633-
if: steps.record.outputs.built != 'true'
634-
run: |
635-
if git ls-remote --exit-code --tags origin "refs/tags/$BUILD_TAG" >/dev/null; then
636-
echo "$BUILD_TAG already exists."
637-
exit 0
638-
fi
639-
git tag "$BUILD_TAG" HEAD
640-
# GitHub occasionally fails ref pushes server-side ("fatal error in commit_refs").
641-
for attempt in 1 2 3; do
642-
if git push origin "refs/tags/$BUILD_TAG"; then
643-
echo "created=true" >> "$GITHUB_OUTPUT"
644-
exit 0
645-
fi
646-
sleep $((attempt * 15))
647-
done
648-
echo "::error::Could not push $BUILD_TAG; nothing was submitted."
649-
exit 1
650-
651629
- name: Submit to Google Play
652630
if: steps.record.outputs.built != 'true'
653631
working-directory: apps/mobile
654-
env:
655-
TAG_CREATED: ${{ steps.tag.outputs.created }}
632+
run: eas submit --platform android --profile production --path "$RUNNER_TEMP/t3code.aab" --non-interactive
633+
634+
# The tag means "delivered", so it follows the submit. If it can't be
635+
# pushed, the next merge rebuilds with a new build number; nothing is lost.
636+
- name: Record build
637+
if: steps.record.outputs.built != 'true'
656638
run: |
657-
if ! eas submit --platform android --profile production --path "$RUNNER_TEMP/t3code.aab" --non-interactive; then
658-
# Unrecord, so the next merge rebuilds and submits again.
659-
if [ "$TAG_CREATED" = "true" ]; then
660-
git push origin --delete "refs/tags/$BUILD_TAG" || echo "::error::Delete tag $BUILD_TAG by hand so the next merge resubmits."
661-
fi
662-
exit 1
639+
if git ls-remote --exit-code --tags origin "refs/tags/$BUILD_TAG" >/dev/null; then
640+
echo "$BUILD_TAG already exists."
641+
else
642+
git tag "$BUILD_TAG" HEAD
643+
# GitHub occasionally fails ref pushes server-side ("fatal error in commit_refs").
644+
for attempt in 1 2 3; do
645+
git push origin "refs/tags/$BUILD_TAG" && break
646+
if [ "$attempt" = 3 ]; then
647+
echo "::error::Submitted, but could not push $BUILD_TAG; the next merge will rebuild."
648+
exit 1
649+
fi
650+
sleep $((attempt * 15))
651+
done
663652
fi
664653
echo ":rocket: android: submitted and recorded \`$BUILD_TAG\`" >> "$GITHUB_STEP_SUMMARY"
665654
@@ -780,39 +769,28 @@ jobs:
780769
export EAS_LOCAL_BUILD_WORKINGDIR="$RUNNER_TEMP/eas-build"
781770
eas build --local --platform ios --profile "$PROFILE" --non-interactive --output "$RUNNER_TEMP/t3code.ipa"
782771
783-
# Record before submitting: a build that can't be recorded is never
784-
# submitted, so the next merge's rebuild can't duplicate a store build.
785-
- id: tag
786-
name: Record build
787-
if: steps.record.outputs.built != 'true'
788-
run: |
789-
if git ls-remote --exit-code --tags origin "refs/tags/$BUILD_TAG" >/dev/null; then
790-
echo "$BUILD_TAG already exists."
791-
exit 0
792-
fi
793-
git tag "$BUILD_TAG" HEAD
794-
# GitHub occasionally fails ref pushes server-side ("fatal error in commit_refs").
795-
for attempt in 1 2 3; do
796-
if git push origin "refs/tags/$BUILD_TAG"; then
797-
echo "created=true" >> "$GITHUB_OUTPUT"
798-
exit 0
799-
fi
800-
sleep $((attempt * 15))
801-
done
802-
echo "::error::Could not push $BUILD_TAG; nothing was submitted."
803-
exit 1
804-
805772
- name: Submit to App Store Connect
806773
if: steps.record.outputs.built != 'true'
807774
working-directory: apps/mobile
808-
env:
809-
TAG_CREATED: ${{ steps.tag.outputs.created }}
775+
run: eas submit --platform ios --profile "$PROFILE" --path "$RUNNER_TEMP/t3code.ipa" --non-interactive
776+
777+
# The tag means "delivered", so it follows the submit. If it can't be
778+
# pushed, the next merge rebuilds with a new build number; nothing is lost.
779+
- name: Record build
780+
if: steps.record.outputs.built != 'true'
810781
run: |
811-
if ! eas submit --platform ios --profile "$PROFILE" --path "$RUNNER_TEMP/t3code.ipa" --non-interactive; then
812-
# Unrecord, so the next merge rebuilds and submits again.
813-
if [ "$TAG_CREATED" = "true" ]; then
814-
git push origin --delete "refs/tags/$BUILD_TAG" || echo "::error::Delete tag $BUILD_TAG by hand so the next merge resubmits."
815-
fi
816-
exit 1
782+
if git ls-remote --exit-code --tags origin "refs/tags/$BUILD_TAG" >/dev/null; then
783+
echo "$BUILD_TAG already exists."
784+
else
785+
git tag "$BUILD_TAG" HEAD
786+
# GitHub occasionally fails ref pushes server-side ("fatal error in commit_refs").
787+
for attempt in 1 2 3; do
788+
git push origin "refs/tags/$BUILD_TAG" && break
789+
if [ "$attempt" = 3 ]; then
790+
echo "::error::Submitted, but could not push $BUILD_TAG; the next merge will rebuild."
791+
exit 1
792+
fi
793+
sleep $((attempt * 15))
794+
done
817795
fi
818796
echo ":rocket: ios: submitted and recorded \`$BUILD_TAG\`" >> "$GITHUB_STEP_SUMMARY"

0 commit comments

Comments
 (0)