1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-11 11:12:03 +02:00

Android release v1.0.290

This commit is contained in:
Laurent Cozic 2019-07-28 18:29:07 +02:00
parent 675a4c795f
commit 2f80bf9647
3 changed files with 36 additions and 79 deletions

View File

@ -28,7 +28,7 @@ Linux | <a href='https://github.com/laurent22/joplin/releases/download/
Operating System | Download | Alt. Download
-----------------|----------|----------------
Android | <a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="40px" src='https://joplinapp.org/images/BadgeAndroid.png'/></a> | or [Download APK File](https://github.com/laurent22/joplin-android/releases/download/android-v1.0.289/joplin-v1.0.289.apk)
Android | <a href='https://play.google.com/store/apps/details?id=net.cozic.joplin&utm_source=GitHub&utm_campaign=README&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' height="40px" src='https://joplinapp.org/images/BadgeAndroid.png'/></a> | or [Download APK File](https://github.com/laurent22/joplin-android/releases/download/android-v1.0.290/joplin-v1.0.290.apk)
iOS | <a href='https://itunes.apple.com/us/app/joplin/id1315599797'><img alt='Get it on the App Store' height="40px" src='https://joplinapp.org/images/BadgeIOS.png'/></a> | -
## Terminal application

View File

@ -94,8 +94,8 @@ android {
applicationId "net.cozic.joplin"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2097525
versionName "1.0.289"
versionCode 2097526
versionName "1.0.290"
ndk {
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}

View File

@ -60,7 +60,7 @@ function gradleVersionName(content) {
async function createRelease(name, tagName, version) {
const originalContents = {};
const suffix = version + (name === 'main' ? '' : name);
const suffix = version + (name === 'main' ? '' : '-' + name);
console.info('Creating release: ' + suffix);
@ -121,8 +121,11 @@ async function createRelease(name, tagName, version) {
console.info('Copying APK to ' + apkFilePath);
await fs.copy('ReactNativeClient/android/app/build/outputs/apk/release/app-release.apk', apkFilePath);
console.info('Copying APK to ' + releaseDir + '/joplin-latest.apk');
await fs.copy('ReactNativeClient/android/app/build/outputs/apk/release/app-release.apk', releaseDir + '/joplin-latest.apk');
if (name === 'main') {
console.info('Copying APK to ' + releaseDir + '/joplin-latest.apk');
await fs.copy('ReactNativeClient/android/app/build/outputs/apk/release/app-release.apk', releaseDir + '/joplin-latest.apk');
}
for (let filename in originalContents) {
const content = originalContents[filename];
@ -140,67 +143,17 @@ async function main() {
const newContent = updateGradleConfig();
const version = gradleVersionName(newContent);
const tagName = 'android-v' + version;
const releaseNames = ['main', '32bit'];
const releaseFiles = {};
const mainReleaseFile = await createRelease('main', tagName, version);
await createRelease('32bit', tagName, version);
// const apkFilename = 'joplin-v' + version + '.apk';
// const apkFilePath = releaseDir + '/' + apkFilename;
// const downloadUrl = 'https://github.com/laurent22/' + projectName + '/releases/download/' + tagName + '/' + apkFilename;
// process.chdir(rootDir);
// console.info('Running from: ' + process.cwd());
// console.info('Building APK file v' + version + '...');
// let restoreDir = null;
// let apkBuildCmd = 'assembleRelease -PbuildDir=build';
// if (await fileExists('/mnt/c/Windows/System32/cmd.exe')) {
// // In recent versions (of Gradle? React Native?), running gradlew.bat from WSL throws the following error:
// // Error: Command failed: /mnt/c/Windows/System32/cmd.exe /c "cd ReactNativeClient\android && gradlew.bat assembleRelease -PbuildDir=build"
// // FAILURE: Build failed with an exception.
// // * What went wrong:
// // Could not determine if Stdout is a console: could not get handle file information (errno 1)
// // So we need to manually run the command from DOS, and then coming back here to finish the process once it's done.
// console.info('Run this command from DOS:');
// console.info('');
// console.info('cd "' + wslToWinPath(rootDir) + '\\ReactNativeClient\\android" && gradlew.bat ' + apkBuildCmd + '"');
// console.info('');
// await readline('Press Enter when done:');
// apkBuildCmd = ''; // Clear the command because we've already ran it
// // apkBuildCmd = '/mnt/c/Windows/System32/cmd.exe /c "cd ReactNativeClient\\android && gradlew.bat ' + apkBuildCmd + '"';
// } else {
// process.chdir(rnDir + '/android');
// apkBuildCmd = './gradlew ' + apkBuildCmd;
// restoreDir = rootDir;
// }
// if (apkBuildCmd) {
// console.info(apkBuildCmd);
// const output = await execCommand(apkBuildCmd);
// console.info(output);
// }
// if (restoreDir) process.chdir(restoreDir);
// await fs.mkdirp(releaseDir);
// console.info('Copying APK to ' + apkFilePath);
// await fs.copy('ReactNativeClient/android/app/build/outputs/apk/release/app-release.apk', apkFilePath);
// console.info('Copying APK to ' + releaseDir + '/joplin-latest.apk');
// await fs.copy('ReactNativeClient/android/app/build/outputs/apk/release/app-release.apk', releaseDir + '/joplin-latest.apk');
for (const releaseName of releaseNames) {
releaseFiles[releaseName] = await createRelease(releaseName, tagName, version);
}
console.info('Updating Readme URL...');
let readmeContent = await fs.readFile('README.md', 'utf8');
readmeContent = readmeContent.replace(/(https:\/\/github.com\/laurent22\/joplin-android\/releases\/download\/.*?\.apk)/, mainReleaseFile.downloadUrl);
readmeContent = readmeContent.replace(/(https:\/\/github.com\/laurent22\/joplin-android\/releases\/download\/.*?\.apk)/, releaseFiles['main'].downloadUrl);
await fs.writeFile('README.md', readmeContent);
console.info(await execCommand('git pull'));
@ -212,28 +165,32 @@ async function main() {
console.info('Creating GitHub release ' + tagName + '...');
const release = await githubRelease(projectName, tagName);
const uploadUrlTemplate = uriTemplate.parse(release.upload_url);
const uploadUrl = uploadUrlTemplate.expand({ name: apkFilename });
for (const releaseFile of releaseFiles) {
const release = await githubRelease(projectName, tagName);
const uploadUrlTemplate = uriTemplate.parse(release.upload_url);
const uploadUrl = uploadUrlTemplate.expand({ name: apkFilename });
const binaryBody = await fs.readFile(apkFilePath);
const binaryBody = await fs.readFile(apkFilePath);
const oauthToken = await githubOauthToken();
const oauthToken = await githubOauthToken();
console.info('Uploading ' + apkFilename + ' to ' + uploadUrl);
console.info('Uploading ' + apkFilename + ' to ' + uploadUrl);
const uploadResponse = await fetch(uploadUrl, {
method: 'POST',
body: binaryBody,
headers: {
'Content-Type': 'application/vnd.android.package-archive',
'Authorization': 'token ' + oauthToken,
'Content-Length': binaryBody.length,
},
});
const uploadResponse = await fetch(uploadUrl, {
method: 'POST',
body: binaryBody,
headers: {
'Content-Type': 'application/vnd.android.package-archive',
'Authorization': 'token ' + oauthToken,
'Content-Length': binaryBody.length,
},
});
const uploadResponseText = await uploadResponse.text();
console.info(uploadResponseText);
const uploadResponseText = await uploadResponse.text();
console.info(uploadResponseText);
}
console.info('Download URL: ' + releaseFiles['main'].downloadUrl);
}
main().catch((error) => {