Skip to content

Commit 46b8010

Browse files
Cal-Lcursoragent
andauthored
chore: source mobile version from build.gradle/pbxproj instead of bitrise.yml (#269)
Mobile release automation previously read the build number from and wrote version fields into bitrise.yml. This coupled the release flow to a file that is no longer a live Bitrise CI config, so consumers could not remove it. Source the build number (versionCode / CURRENT_PROJECT_VERSION) and semver (versionName / MARKETING_VERSION) directly from android/app/build.gradle and ios/MetaMask.xcodeproj/project.pbxproj, matching mobile's own scripts/set-build-version.sh. Extension flow is unaffected. - set-semvar-version.sh: drop bitrise VERSION_NAME write and the bitrise-based build-number alignment check - set-mobile-build-version.sh: read/write build.gradle + pbxproj, drop bitrise and the flask alignment check - create-platform-release-pr.sh: drop bitrise.yml from mobile expected files - stable-sync action: drop bitrise.yml from PR body preservation text Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5b4e607 commit 46b8010

5 files changed

Lines changed: 21 additions & 56 deletions

File tree

.github/actions/stable-sync/action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ runs:
133133
134134
Preserves specific files from the stable branch:
135135
- CHANGELOG.md
136-
- bitrise.yml
137136
- android/app/build.gradle
138137
- ios/MetaMask.xcodeproj/project.pbxproj
139138
- package.json

.github/scripts/create-platform-release-pr.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ get_expected_changed_files() {
7979
local expected_changed_files=""
8080

8181
if [[ "$platform" == "mobile" ]]; then
82-
expected_changed_files="package.json android/app/build.gradle ios/MetaMask.xcodeproj/project.pbxproj bitrise.yml"
82+
expected_changed_files="package.json android/app/build.gradle ios/MetaMask.xcodeproj/project.pbxproj"
8383
elif [[ "$platform" == "extension" ]]; then
8484
expected_changed_files="package.json"
8585
else

.github/scripts/set-mobile-build-version.sh

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ SEMVER_REGEX="\
2626

2727
PACKAGE_JSON_FILE=package.json
2828
ANDROID_BUILD_GRADLE_FILE=android/app/build.gradle
29-
BITRISE_YML_FILE=bitrise.yml
3029
IOS_PROJECT_FILE=ios/MetaMask.xcodeproj/project.pbxproj
3130

3231
semver_to_nat () {
@@ -51,12 +50,6 @@ update_mobile_files () {
5150
sed -i '' -E "s/(\s*versionCode )[0-9]+/\1$VERSION_NUMBER/" $ANDROID_BUILD_GRADLE_FILE
5251
echo "- $ANDROID_BUILD_GRADLE_FILE successfully updated"
5352

54-
# update bitrise.yml
55-
echo "Updating Bitrise configuration files..."
56-
sed -i '' -E "s/(\s*VERSION_NUMBER: )[0-9]+/\1$VERSION_NUMBER/" $BITRISE_YML_FILE
57-
sed -i '' -E "s/(\s*FLASK_VERSION_NUMBER: )[0-9]+/\1$VERSION_NUMBER/" $BITRISE_YML_FILE
58-
echo "- $BITRISE_YML_FILE successfully updated"
59-
6053
# update ios/MetaMask.xcodeproj/project.pbxproj
6154
echo "Updating iOS project settings..."
6255
sed -i '' -E "s/(\s*CURRENT_PROJECT_VERSION = )[0-9]+/\1$VERSION_NUMBER/" $IOS_PROJECT_FILE
@@ -70,12 +63,6 @@ update_mobile_files () {
7063
sed -i -E "s/(\s*versionCode )[0-9]+/\1$VERSION_NUMBER/" $ANDROID_BUILD_GRADLE_FILE
7164
echo "- $ANDROID_BUILD_GRADLE_FILE successfully updated"
7265

73-
# update bitrise.yml
74-
echo "Updating Bitrise configuration files..."
75-
sed -i -E "s/(\s*VERSION_NUMBER: )[0-9]+/\1$VERSION_NUMBER/" $BITRISE_YML_FILE
76-
sed -i -E "s/(\s*FLASK_VERSION_NUMBER: )[0-9]+/\1$VERSION_NUMBER/" $BITRISE_YML_FILE
77-
echo "- $BITRISE_YML_FILE successfully updated"
78-
7966
# update ios/MetaMask.xcodeproj/project.pbxproj
8067
echo "Updating iOS project settings..."
8168
sed -i -E "s/(\s*CURRENT_PROJECT_VERSION = )[0-9]+/\1$VERSION_NUMBER/" $IOS_PROJECT_FILE
@@ -86,16 +73,10 @@ update_mobile_files () {
8673
echo "All specified files updated with version number: $VERSION_NUMBER"
8774
}
8875

89-
# get current numbers
90-
CURRENT_VERSION_NUMBER=$(awk '/^\s+VERSION_NUMBER: /{print $2}' $BITRISE_YML_FILE);
91-
CURRENT_FLASK_VERSION_NUMBER=$(awk '/^\s+FLASK_VERSION_NUMBER: /{print $2}' $BITRISE_YML_FILE);
92-
93-
# ensure version number of main variant and flask are aligned
94-
if [[ "$CURRENT_VERSION_NUMBER" != "$CURRENT_FLASK_VERSION_NUMBER" ]]; then
95-
echo "VERSION_NUMBER $CURRENT_VERSION_NUMBER and FLASK_VERSION_NUMBER $CURRENT_FLASK_VERSION_NUMBER should be the same"
96-
log_and_exit "Check why they are different and fix it before proceeding"
97-
fi
98-
76+
# Extract current build numbers from Android and iOS sources of truth.
77+
# Use POSIX [[:space:]] for cross-platform awk compatibility (macOS BSD awk doesn't support \s).
78+
CURRENT_ANDROID_VERSION_NUMBER=$(awk '/^[[:space:]]+versionCode /{print $2; exit}' $ANDROID_BUILD_GRADLE_FILE)
79+
CURRENT_IOS_VERSION_NUMBER=$(awk -F'[[:space:]=;]+' '/CURRENT_PROJECT_VERSION/{print $3; exit}' $IOS_PROJECT_FILE)
9980

10081
if [[ -z $VERSION_NUMBER ]]; then
10182
log_and_exit "VERSION_NUMBER not specified, aborting!"
@@ -107,12 +88,17 @@ if ! [[ $VERSION_NUMBER =~ $NAT ]] || [[ $VERSION_NUMBER =~ $SEMVER_REGEX ]]; th
10788
fi
10889

10990
echo "VERSION_NUMBER is $VERSION_NUMBER."
110-
echo "CURRENT_VERSION_NUMBER is $CURRENT_VERSION_NUMBER."
91+
echo "CURRENT_ANDROID_VERSION_NUMBER is $CURRENT_ANDROID_VERSION_NUMBER."
92+
echo "CURRENT_IOS_VERSION_NUMBER is $CURRENT_IOS_VERSION_NUMBER."
93+
94+
# ensure Android version number goes up
95+
if [[ "$VERSION_NUMBER" -le "$CURRENT_ANDROID_VERSION_NUMBER" ]]; then
96+
log_and_exit "Android version $VERSION_NUMBER is less than or equal to current: $CURRENT_ANDROID_VERSION_NUMBER"
97+
fi
11198

112-
# ensure VERSION_NUMBER goes up
113-
if [[ "$VERSION_NUMBER" -le "$CURRENT_VERSION_NUMBER" ]]; then
114-
echo "version $VERSION_NUMBER is less than or equal to current: $CURRENT_VERSION_NUMBER"
115-
exit 1
99+
# ensure iOS version number goes up
100+
if [[ "$VERSION_NUMBER" -le "$CURRENT_IOS_VERSION_NUMBER" ]]; then
101+
log_and_exit "iOS version $VERSION_NUMBER is less than or equal to current: $CURRENT_IOS_VERSION_NUMBER"
116102
fi
117103

118104
echo "VERSION_NUMBER is valid."

.github/scripts/set-semvar-version.sh

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Script to update semantic versioning across MetaMask platform files
44
# This script handles version updates for both mobile and extension platforms
5-
# For mobile: Updates package.json, Android build.gradle, Bitrise config, and iOS project files
5+
# For mobile: Updates package.json, Android build.gradle, and iOS project files
66
# For extension: Updates package.json only
77

88
set -e
@@ -36,7 +36,6 @@ SEMVER_REGEX="\
3636
# File paths for version updates
3737
PACKAGE_JSON_FILE=package.json
3838
ANDROID_BUILD_GRADLE_FILE=android/app/build.gradle
39-
BITRISE_YML_FILE=bitrise.yml
4039
IOS_PROJECT_FILE=ios/MetaMask.xcodeproj/project.pbxproj
4140

4241
# Helper Functions
@@ -73,11 +72,6 @@ update_mobile_files () {
7372
sed -i '' 's/\(\s*versionName \)".*"/\1"'"$SEMVER_VERSION"'"/' "$ANDROID_BUILD_GRADLE_FILE"
7473
echo "- $ANDROID_BUILD_GRADLE_FILE successfully updated"
7574

76-
# Update version in Bitrise configuration
77-
echo "Updating Bitrise configuration files..."
78-
sed -i '' 's/\(\s*VERSION_NAME: \).*/\1'"$SEMVER_VERSION"'/' "$BITRISE_YML_FILE"
79-
echo "- $BITRISE_YML_FILE successfully updated"
80-
8175
# Update iOS marketing version
8276
echo "Updating iOS project settings..."
8377
sed -i '' 's/\(\s*MARKETING_VERSION = \).*/\1'"$SEMVER_VERSION;"'/' "$IOS_PROJECT_FILE"
@@ -91,11 +85,6 @@ update_mobile_files () {
9185
sed -i 's/\(\s*versionName \)".*"/\1"'"$SEMVER_VERSION"'"/' "$ANDROID_BUILD_GRADLE_FILE"
9286
echo "- $ANDROID_BUILD_GRADLE_FILE updated"
9387

94-
# Update version in Bitrise configuration
95-
echo "Updating Bitrise configuration files..."
96-
sed -i 's/\(\s*VERSION_NAME: \).*/\1'"$SEMVER_VERSION"'/' "$BITRISE_YML_FILE"
97-
echo "- $BITRISE_YML_FILE updated"
98-
9988
# update ios/MetaMask.xcodeproj/project.pbxproj
10089
echo "Updating iOS project settings..."
10190
sed -i 's/\(\s*MARKETING_VERSION = \).*/\1'"$SEMVER_VERSION;"'/' "$IOS_PROJECT_FILE"
@@ -104,7 +93,6 @@ update_mobile_files () {
10493

10594
# Print summary of updates
10695
echo "- $ANDROID_BUILD_GRADLE_FILE updated"
107-
echo "- $BITRISE_YML_FILE updated"
10896
echo "- $IOS_PROJECT_FILE updated"
10997

11098
echo "-------------------"
@@ -125,19 +113,6 @@ if ! [[ $SEMVER_VERSION =~ $SEMVER_REGEX ]]; then
125113
log_and_exit "$SEMVER_VERSION is invalid semver!"
126114
fi
127115

128-
# Validate inputs for mobile platform
129-
if [[ $PLATFORM == "mobile" ]]; then
130-
# Get current version numbers from bitrise.yml
131-
CURRENT_VERSION_NUMBER=$(awk '/^\s+VERSION_NUMBER: /{print $2}' $BITRISE_YML_FILE);
132-
CURRENT_FLASK_VERSION_NUMBER=$(awk '/^\s+FLASK_VERSION_NUMBER: /{print $2}' $BITRISE_YML_FILE);
133-
134-
# Ensure version number of main variant and flask are aligned
135-
if [[ "$CURRENT_VERSION_NUMBER" != "$CURRENT_FLASK_VERSION_NUMBER" ]]; then
136-
echo "VERSION_NUMBER $CURRENT_VERSION_NUMBER and FLASK_VERSION_NUMBER $CURRENT_FLASK_VERSION_NUMBER should be the same"
137-
log_and_exit "Check why they are different and fix it before proceeding"
138-
fi
139-
fi
140-
141116
echo "SEMVER_VERSION is valid."
142117
echo -e "-------------------"
143118
echo "Updating files:"

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Mobile release automation no longer reads from or writes to `bitrise.yml`; the build number (`versionCode` / `CURRENT_PROJECT_VERSION`) and semver (`versionName` / `MARKETING_VERSION`) are now sourced from `android/app/build.gradle` and `ios/MetaMask.xcodeproj/project.pbxproj` directly
13+
- `set-semvar-version.sh`, `set-mobile-build-version.sh`, and `create-platform-release-pr.sh` updated accordingly, allowing consumers to remove `bitrise.yml`
14+
1015
## [1.15.0]
1116

1217
### Added

0 commit comments

Comments
 (0)