Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions scripts/release-channel.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ exclude = ["src/apps/relay-server", "OpenBitFun-Installer/src-tauri"]
);
assert.match(
readFileSync(path.join(root, 'src/apps/mobile/android/app/build.gradle.kts'), 'utf8'),
/versionName = "1\.1\.0-beta\.2"/,
/versionName = "1\.0\.0"/,
);
assert.match(
readFileSync(path.join(root, 'src/apps/mobile/ios/OpenBitFun/Info.plist'), 'utf8'),
/<string>1\.1\.0-beta\.2<\/string>/,
/<string>1\.0\.0<\/string>/,
);
assert.match(
readFileSync(path.join(root, 'src/apps/mobile/harmonyos/AppScope/app.json5'), 'utf8'),
/"versionName": "1\.1\.0-beta\.2"/,
/"versionName": "1\.0\.0"/,
);
assert.match(
readFileSync(path.join(root, 'Cargo.lock'), 'utf8'),
Expand Down
16 changes: 0 additions & 16 deletions scripts/set-build-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,6 @@ export function setBuildVersion(root, version) {
);
}

replaceVersion(
path.join(root, 'src/apps/mobile/android/app/build.gradle.kts'),
/^(\s*versionName\s*=\s*")[^"]+(".*)$/m,
`$1${version}$2`,
);
replaceVersion(
path.join(root, 'src/apps/mobile/ios/OpenBitFun/Info.plist'),
/(<key>CFBundleShortVersionString<\/key>\s*<string>)[^<]+(<\/string>)/m,
`$1${version}$2`,
);
replaceVersion(
path.join(root, 'src/apps/mobile/harmonyos/AppScope/app.json5'),
/^(\s*"versionName"\s*:\s*")[^"]+(".*)$/m,
`$1${version}$2`,
);

syncCargoLock(root);
}

Expand Down
16 changes: 14 additions & 2 deletions scripts/tauri-release-manifest.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,24 @@ import test from 'node:test';

const root = path.resolve(import.meta.dirname, '..');

test('release version metadata is synchronized', () => {
test('desktop and mobile release metadata are synchronized within their own groups', () => {
const version = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).version;
const result = run('scripts/verify-release-version-sync.mjs', ['--version', version]);
const result = run('scripts/verify-release-version-sync.mjs', [
'--version', version,
'--mobile-version', '1.0.0',
]);
assert.equal(result.status, 0, result.stderr);
});

test('mobile release metadata rejects drift within the mobile group', () => {
const result = run('scripts/verify-release-version-sync.mjs', [
'--version', JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).version,
'--mobile-version', '1.0.1',
]);
assert.notEqual(result.status, 0);
assert.match(result.stderr, /expected mobile 1\.0\.1/);
});

test('prepares a versioned custom Windows installer asset', () => {
const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'openbitfun-manual-installer-'));
const assets = path.join(temp, 'assets', 'nested');
Expand Down
20 changes: 15 additions & 5 deletions scripts/verify-release-version-sync.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { readFileSync } from 'fs';

const args = parseArgs(process.argv.slice(2));
// Desktop release workflows resolve their version from the root package. Mobile
// apps ship on their own cadence, so they form a separate consistency group.
const expected = args.version || readJsonVersion('package.json');
const versions = new Map([
['package.json', readJsonVersion('package.json')],
Expand All @@ -15,6 +17,9 @@ const versions = new Map([
['src/apps/relay-server/Cargo.toml', readTomlVersion('src/apps/relay-server/Cargo.toml', /version = "([^"]+)" # x-release-please-version/)],
['src/crates/services/relay-service/Cargo.toml', readTomlVersion('src/crates/services/relay-service/Cargo.toml', /^version = "([^"]+)"/m)],
['src/crates/services/page-function-runtime/Cargo.toml', readTomlVersion('src/crates/services/page-function-runtime/Cargo.toml', /^version = "([^"]+)"/m)],
]);

const mobileVersions = new Map([
['src/apps/mobile/android/app/build.gradle.kts', readTextVersion('src/apps/mobile/android/app/build.gradle.kts', /versionName\s*=\s*"([^"]+)"/)],
['src/apps/mobile/ios/OpenBitFun/Info.plist', readTextVersion('src/apps/mobile/ios/OpenBitFun/Info.plist', /<key>CFBundleShortVersionString<\/key>\s*<string>([^<]+)<\/string>/)],
['src/apps/mobile/harmonyos/AppScope/app.json5', readTextVersion('src/apps/mobile/harmonyos/AppScope/app.json5', /"versionName"\s*:\s*"([^"]+)"/)],
Expand All @@ -26,13 +31,18 @@ if (!expected.includes('-')) {
}

const mismatches = [...versions].filter(([, version]) => version !== expected);
if (mismatches.length > 0) {
for (const [file, version] of mismatches) {
console.error(`[release-version] ${file}: expected ${expected}, found ${version}`);
}
const mobileExpected = args['mobile-version'] || mobileVersions.values().next().value;
const mobileMismatches = [...mobileVersions].filter(([, version]) => version !== mobileExpected);
for (const [file, version] of mismatches) {
console.error(`[release-version] ${file}: expected ${expected}, found ${version}`);
}
for (const [file, version] of mobileMismatches) {
console.error(`[release-version] ${file}: expected mobile ${mobileExpected}, found ${version}`);
}
if (mismatches.length > 0 || mobileMismatches.length > 0) {
process.exit(1);
}
console.log(`[release-version] OK: ${expected}`);
console.log(`[release-version] OK: desktop ${expected}; mobile ${mobileExpected}`);

function readJsonVersion(file) {
return JSON.parse(readFileSync(file, 'utf8')).version;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/mobile/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
minSdk = libs.versions.androidMinSdk.get().toInt()
targetSdk = libs.versions.androidTargetSdk.get().toInt()
versionCode = 1
versionName = "1.0.2"
versionName = "1.0.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
4 changes: 2 additions & 2 deletions src/apps/mobile/harmonyos/AppScope/app.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// upgrades retain encrypted sessions, preferences, and watch handoff data.
"bundleName": "com.bitfun.app",
"vendor": "OpenBitFun",
"versionCode": 1,
"versionName": "1.0.2", // x-release-please-version
"versionCode": 4,
"versionName": "1.0.0", // x-release-please-version
"buildVersion": "1",
"icon": "$media:openbitfun_app_icon",
"label": "$string:app_name",
Expand Down
4 changes: 2 additions & 2 deletions src/apps/mobile/ios/OpenBitFun/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.2</string>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down
Loading