diff --git a/ElectronClient/app/package-lock.json b/ElectronClient/app/package-lock.json index 1b7dc77a34..08ed38b1bc 100644 --- a/ElectronClient/app/package-lock.json +++ b/ElectronClient/app/package-lock.json @@ -1,6 +1,6 @@ { "name": "Joplin", - "version": "0.10.23", + "version": "0.10.24", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/ElectronClient/app/package.json b/ElectronClient/app/package.json index 1d6f526bcc..810c773251 100644 --- a/ElectronClient/app/package.json +++ b/ElectronClient/app/package.json @@ -1,6 +1,6 @@ { "name": "Joplin", - "version": "0.10.23", + "version": "0.10.24", "description": "Joplin for Desktop", "main": "main.js", "scripts": { diff --git a/ElectronClient/app/update-readme-download.js b/ElectronClient/app/update-readme-download.js index 50eb7741ba..710d951b8c 100644 --- a/ElectronClient/app/update-readme-download.js +++ b/ElectronClient/app/update-readme-download.js @@ -7,6 +7,14 @@ const request = require('request'); const url = 'https://api.github.com/repos/laurent22/joplin/releases/latest'; const readmePath = __dirname + '/../../README.md'; +async function msleep(ms) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(); + }, ms); + }); +} + async function gitHubLatestRelease() { return new Promise((resolve, reject) => { request.get({ @@ -48,8 +56,23 @@ function setReadmeContent(content) { return fs.writeFileSync(readmePath, content); } -async function main() { - const release = await gitHubLatestRelease(); +async function main(argv) { + const waitForVersion = argv.length === 3 ? argv[2] : null; + + if (waitForVersion) console.info('Waiting for version ' + waitForVersion + ' to be released before updating readme...'); + + let release = null; + while (true) { + release = await gitHubLatestRelease(); + if (!waitForVersion) break; + + if (release.tag_name !== waitForVersion) { + await msleep(15000); + } else { + console.info('Got version ' + waitForVersion); + break; + } + } const winUrl = downloadUrl(release, 'windows'); const macOsUrl = downloadUrl(release, 'macos'); @@ -64,6 +87,6 @@ async function main() { setReadmeContent(content); } -main().catch((error) => { +main(process.argv).catch((error) => { console.error('Fatal error', error); }); \ No newline at end of file diff --git a/ElectronClient/release_version.sh b/ElectronClient/release_version.sh index 2a798aba01..440416daf5 100755 --- a/ElectronClient/release_version.sh +++ b/ElectronClient/release_version.sh @@ -9,4 +9,6 @@ git commit -m "Electron release $VERSION" git tag $VERSION git push && git push --tags -echo "Create a draft release at: https://github.com/laurent22/joplin/releases/tag/$VERSION" \ No newline at end of file +echo "Create a draft release at: https://github.com/laurent22/joplin/releases/tag/$VERSION" + +node "$APP_DIR/update-readme-download.js v$VERSION" \ No newline at end of file