Skip to content

Commit 3257d87

Browse files
committed
fix: sync ios xcode version from release tag
1 parent 4829057 commit 3257d87

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/electron-release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ jobs:
301301
fi
302302
# CFBundleShortVersionString(version) 与 CFBundleVersion(build) 都取 V → 可对应 tag / CI run。
303303
node -e "const fs=require('fs');const p='app.json';const j=JSON.parse(fs.readFileSync(p,'utf8'));j.expo.version=String(process.argv[1]);j.expo.ios=j.expo.ios||{};j.expo.ios.buildNumber=String(process.argv[1]);fs.writeFileSync(p,JSON.stringify(j,null,2)+'\n');" "$V"
304+
echo "MOBILE_RELEASE_VERSION=$V" >> "$GITHUB_ENV"
304305
305306
- name: Install mobile deps
306307
working-directory: mobile
@@ -310,6 +311,28 @@ jobs:
310311
working-directory: mobile
311312
run: npx expo prebuild -p ios --no-install
312313

314+
- name: Sync iOS Xcode version settings
315+
working-directory: mobile
316+
shell: bash
317+
run: |
318+
set -euo pipefail
319+
: "${MOBILE_RELEASE_VERSION:?Missing MOBILE_RELEASE_VERSION}"
320+
export MOBILE_RELEASE_VERSION
321+
PBX="ios/MonkeyCode.xcodeproj/project.pbxproj"
322+
PLIST="ios/MonkeyCode/Info.plist"
323+
test -f "$PBX"
324+
test -f "$PLIST"
325+
326+
perl -0pi -e 's/(MARKETING_VERSION = )[^;]+;/${1}$ENV{MOBILE_RELEASE_VERSION};/g; s/(CURRENT_PROJECT_VERSION = )[^;]+;/${1}$ENV{MOBILE_RELEASE_VERSION};/g' "$PBX"
327+
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $MOBILE_RELEASE_VERSION" "$PLIST"
328+
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $MOBILE_RELEASE_VERSION" "$PLIST"
329+
330+
SHORT_VERSION=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$PLIST")
331+
BUILD_VERSION=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$PLIST")
332+
test "$SHORT_VERSION" = "$MOBILE_RELEASE_VERSION"
333+
test "$BUILD_VERSION" = "$MOBILE_RELEASE_VERSION"
334+
grep -nE "MARKETING_VERSION = $MOBILE_RELEASE_VERSION;|CURRENT_PROJECT_VERSION = $MOBILE_RELEASE_VERSION;" "$PBX"
335+
313336
- name: Pod install
314337
working-directory: mobile/ios
315338
run: pod install

0 commit comments

Comments
 (0)