Files
etf-oglasi/frontend/scripts/set-mobile-version.js
T
ksan 694b68cbc5
CI/CD / Backend Unit Tests (push) Successful in 2m11s
CI/CD / Deploy (push) Successful in 2m0s
CI/CD / Mobile Release (push) Failing after 21m39s
updated ci/cd to add releases and testing claude code on my project
2026-06-11 15:11:09 +02:00

29 lines
1.0 KiB
JavaScript

// Used by CI to stamp a mobile release build with its version number.
// Updates version.json (read by hooks/useUpdatecheck.tsx) and app.json's
// android.versionCode/versionName so the build, the in-app update check,
// and the Gitea release tag (mobile-vN) all agree on the same number.
const fs = require('fs');
const path = require('path');
const version = parseInt(process.argv[2], 10);
if (!Number.isInteger(version) || version <= 0) {
console.error('Usage: node set-mobile-version.js <positive integer>');
process.exit(1);
}
const root = path.join(__dirname, '..');
fs.writeFileSync(
path.join(root, 'version.json'),
JSON.stringify({ version }, null, 2) + '\n',
);
const appJsonPath = path.join(root, 'app.json');
const appJson = JSON.parse(fs.readFileSync(appJsonPath, 'utf8'));
appJson.expo.version = `1.0.${version}`;
appJson.expo.android = appJson.expo.android ?? {};
appJson.expo.android.versionCode = version;
fs.writeFileSync(appJsonPath, JSON.stringify(appJson, null, 2) + '\n');
console.log(`Stamped mobile version ${version}`);