1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Tools: Make it easier to create Android pre-releases

This commit is contained in:
Laurent Cozic 2020-09-04 19:11:46 +01:00
parent 44f2842820
commit e5b5250a91

View File

@ -58,9 +58,9 @@ function gradleVersionName(content) {
return matches[1];
}
async function createRelease(name, tagName, version, rcSuffix) {
async function createRelease(name, tagName, version) {
const originalContents = {};
const suffix = version + rcSuffix + (name === 'main' ? '' : `-${name}`);
const suffix = version + (name === 'main' ? '' : `-${name}`);
console.info(`Creating release: ${suffix}`);
@ -151,22 +151,22 @@ async function createRelease(name, tagName, version, rcSuffix) {
async function main() {
const argv = require('yargs').argv;
const rcSuffix = argv.rc ? `-${argv.rc}` : '';
const isPreRelease = !!argv.prerelease;
if (rcSuffix) console.info(`Creating release candidate ${argv.rc}`);
if (isPreRelease) console.info('Creating pre-release');
console.info('Updating version numbers in build.gradle...');
const newContent = updateGradleConfig();
const version = gradleVersionName(newContent);
const tagName = `android-v${version}${rcSuffix}`;
const tagName = `android-v${version}`;
const releaseNames = ['main', '32bit'];
const releaseFiles = {};
for (const releaseName of releaseNames) {
releaseFiles[releaseName] = await createRelease(releaseName, tagName, version, rcSuffix);
releaseFiles[releaseName] = await createRelease(releaseName, tagName, version);
}
if (!rcSuffix) {
if (!isPreRelease) {
console.info('Updating Readme URL...');
let readmeContent = await fs.readFile('README.md', 'utf8');
@ -177,14 +177,14 @@ async function main() {
console.info(await execCommand('git pull'));
console.info(await execCommand('git add -A'));
console.info(await execCommand(`git commit -m "Android release v${version}${rcSuffix}"`));
console.info(await execCommand(`git commit -m "Android release v${version}"`));
console.info(await execCommand(`git tag ${tagName}`));
console.info(await execCommand('git push'));
console.info(await execCommand('git push --tags'));
console.info(`Creating GitHub release ${tagName}...`);
const releaseOptions = { isPreRelease: !!rcSuffix };
const releaseOptions = { isPreRelease: isPreRelease };
const oauthToken = await githubOauthToken();
const release = await githubRelease(projectName, tagName, releaseOptions);