mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Tools: Allow publishing varients
This commit is contained in:
parent
20b43ce56e
commit
a76c5c8746
@ -139,16 +139,6 @@ def reactNativeArchitectures() {
|
||||
}
|
||||
|
||||
android {
|
||||
flavorDimensions "version"
|
||||
|
||||
productFlavors {
|
||||
mod {
|
||||
dimension "version"
|
||||
applicationIdSuffix ".mod"
|
||||
versionNameSuffix = "-mod"
|
||||
}
|
||||
}
|
||||
|
||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||
|
||||
compileOptions {
|
||||
@ -166,8 +156,8 @@ android {
|
||||
applicationId "net.cozic.joplin"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 2097702
|
||||
versionName "2.11.17"
|
||||
versionCode 2097705
|
||||
versionName "2.11.20"
|
||||
// ndk {
|
||||
// abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
|
||||
// }
|
||||
|
@ -94,11 +94,6 @@ function gradleVersionName(content: string) {
|
||||
return matches[1];
|
||||
}
|
||||
|
||||
const assembleCommandName = (releaseName: string) => {
|
||||
if (releaseName === 'vosk') return 'assembleMod';
|
||||
return 'assembleRelease';
|
||||
};
|
||||
|
||||
async function createRelease(projectName: string, name: string, tagName: string, version: string): Promise<Release> {
|
||||
const suffix = version + (name === 'main' ? '' : `-${name}`);
|
||||
|
||||
@ -119,15 +114,22 @@ async function createRelease(projectName: string, name: string, tagName: string,
|
||||
return readFile(`${rnDir}/services/voiceTyping/vosk.dummy.ts`, 'utf8');
|
||||
});
|
||||
|
||||
// await patcher.updateFileContent(`${rnDir}/android/app/build.gradle`, async (content: string) => {
|
||||
// content = content.replace(/\s+"react-native-vosk": ".*",/, '');
|
||||
// content = content.replace(/(\s+)"applicationId "net.cozic.joplin"/, '$1"applicationId "net.cozic.joplin-mod"');
|
||||
// return content;
|
||||
// });
|
||||
await patcher.updateFileContent(`${rnDir}/android/app/build.gradle`, async (content: string) => {
|
||||
content = content.replace(/\s+"react-native-vosk": ".*",/, '');
|
||||
return content;
|
||||
});
|
||||
|
||||
await patcher.removeFile(`${rnDir}/android/app/src/main/assets/model-fr-fr`);
|
||||
}
|
||||
|
||||
if (name === 'vosk') {
|
||||
await patcher.updateFileContent(`${rnDir}/android/app/build.gradle`, async (content: string) => {
|
||||
content = content.replace(/(\s+)applicationId "net.cozic.joplin"/, '$1applicationId "net.cozic.joplin.mod"');
|
||||
content = content.replace(/(\s+)versionName "(\d+\.\d+\.\d+)"/, '$1versionName "$2-mod"');
|
||||
return content;
|
||||
});
|
||||
}
|
||||
|
||||
const apkFilename = `joplin-v${suffix}.apk`;
|
||||
const apkFilePath = `${releaseDir}/${apkFilename}`;
|
||||
const downloadUrl = `https://github.com/laurent22/${projectName}/releases/download/${tagName}/${apkFilename}`;
|
||||
@ -148,7 +150,7 @@ async function createRelease(projectName: string, name: string, tagName: string,
|
||||
let restoreDir = null;
|
||||
let apkBuildCmd = '';
|
||||
let apkCleanBuild = '';
|
||||
const apkBuildCmdArgs = [assembleCommandName(name), `-PbuildDir=${buildDirName}`];
|
||||
const apkBuildCmdArgs = ['assembleRelease', `-PbuildDir=${buildDirName}`];
|
||||
if (await fileExists('/mnt/c/Windows/System32/cmd.exe')) {
|
||||
await execCommandWithPipes('/mnt/c/Windows/System32/cmd.exe', ['/c', `cd packages\\app-mobile\\android && gradlew.bat ${apkBuildCmd}`]);
|
||||
apkBuildCmd = '';
|
||||
@ -253,6 +255,9 @@ async function main() {
|
||||
releaseFiles[releaseName] = await createRelease(projectName, releaseName, tagName, version);
|
||||
}
|
||||
|
||||
console.info('Created releases:');
|
||||
console.info(releaseFiles);
|
||||
|
||||
const voskRelease = releaseFiles['vosk'];
|
||||
delete releaseFiles['vosk'];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user