ci: allow protected mobile candidate

This commit is contained in:
Yun Chan 2026-08-30 09:20:49 +09:00
parent 4872d6f6c5
commit 1f71cf6fae
3 changed files with 797 additions and 9 deletions

View file

@ -284,10 +284,11 @@ package-macos:
rules:
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+.*$/'
# Protected, manually approved Play Console handoff. Configure the three
# *_FILE variables below as protected GitLab file variables scoped to the
# mobile-production-release environment. All other credentials must be
# protected, masked, and hidden project/group variables.
# Protected, manually approved Play Console candidate/stable handoff. The main
# branch path only creates restricted artifacts; publish-release remains tag-only.
# Configure the three *_FILE variables below as protected GitLab file variables
# scoped to the mobile-production-release environment. All other credentials
# must be protected, masked, and hidden project/group variables.
mobile-production-release:
stage: package
image: reactnativecommunity/react-native-android@sha256:24ca7ab5a70ec0b78a81bdc5eeea5924c2531531d53971b6f2321aff08446c36
@ -320,10 +321,11 @@ mobile-production-release:
tar -xJf /tmp/node.tar.xz -C /tmp/node24 --strip-components=1
export PATH="/tmp/node24/bin:$PATH"
node --version | grep -Fx "v${NODE_VERSION}"
git fetch --no-tags origin main
git fetch --no-tags origin main:refs/remotes/origin/main
git merge-base --is-ancestor "$CI_COMMIT_SHA" origin/main
test "$CI_COMMIT_SHA" = "$(git rev-parse HEAD)"
test -z "$(git status --porcelain --untracked-files=all)"
test "${CI_COMMIT_REF_PROTECTED:-}" = "true"
SOURCE_TREE_SHA="$(git rev-parse "${CI_COMMIT_SHA}^{tree}")"
VERSION_NAME="$(node -p "require('./release/product-version.json').version")"
VERSION_CODE="$(node -p "require('./release/product-version.json').androidVersionCode")"
@ -331,7 +333,16 @@ mobile-production-release:
ADMOB_APP_ID="$(node -p "require('./release/android-release-identity.json').adMobAppId")"
ADMOB_BANNER_UNIT_ID="$(node -p "require('./release/android-release-identity.json').adMobBannerUnitId")"
ADMOB_REWARDED_UNIT_ID="$(node -p "require('./release/android-release-identity.json').adMobRewardedUnitId")"
test "$CI_COMMIT_TAG" = "v${VERSION_NAME}"
if [ -n "${CI_COMMIT_TAG:-}" ]; then
test -z "${CI_COMMIT_BRANCH:-}"
test "$CI_COMMIT_TAG" = "v${VERSION_NAME}"
test "$(git rev-parse "refs/tags/${CI_COMMIT_TAG}^{commit}")" = "$CI_COMMIT_SHA"
RELEASE_GIT_REF="refs/tags/${CI_COMMIT_TAG}"
else
test "${CI_COMMIT_BRANCH:-}" = "main"
test "$CI_COMMIT_SHA" = "$(git rev-parse origin/main)"
RELEASE_GIT_REF="refs/heads/main"
fi
echo "$VERSION_NAME" | grep -Eq '^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
echo "$VERSION_CODE" | grep -Eq '^[1-9][0-9]{0,9}$'
test "$VERSION_CODE" -le 2100000000
@ -387,7 +398,7 @@ mobile-production-release:
--repository "$CI_PROJECT_PATH" \
--commit-sha "$CI_COMMIT_SHA" \
--tree-sha "$SOURCE_TREE_SHA" \
--git-ref "refs/tags/$CI_COMMIT_TAG" \
--git-ref "$RELEASE_GIT_REF" \
--workflow-identity "gitlab-ci/mobile-production-release" \
--run-id "$CI_JOB_ID" \
--run-attempt "1" \
@ -414,7 +425,7 @@ mobile-production-release:
--expected-repository "$CI_PROJECT_PATH" \
--expected-commit-sha "$CI_COMMIT_SHA" \
--expected-tree-sha "$SOURCE_TREE_SHA" \
--expected-git-ref "refs/tags/$CI_COMMIT_TAG" \
--expected-git-ref "$RELEASE_GIT_REF" \
--expected-workflow-identity "gitlab-ci/mobile-production-release" \
--expected-run-id "$CI_JOB_ID" \
--expected-run-attempt "1" \
@ -449,7 +460,10 @@ mobile-production-release:
- apps/mobile-rn/android/app/build/outputs/release-app-links-evidence.json
manual_confirmation: '검증된 production AAB를 생성해 Maintainer 전용 Play Console handoff로 보낼까요?'
rules:
- if: '$D3RO_MOBILE_PRODUCTION_RELEASE_ENABLED == "true" && $D3RO_ANDROID_EMULATOR_RUNNER == "true" && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
- if: '$D3RO_MOBILE_PRODUCTION_RELEASE_ENABLED == "true" && $D3RO_ANDROID_EMULATOR_RUNNER == "true" && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+$/'
when: manual
allow_failure: false
- if: '$D3RO_MOBILE_PRODUCTION_RELEASE_ENABLED == "true" && $D3RO_ANDROID_EMULATOR_RUNNER == "true" && $CI_COMMIT_REF_PROTECTED == "true" && $CI_COMMIT_BRANCH == "main"'
when: manual
allow_failure: false
- when: never