Add release wizard
This commit is contained in:
+5
-5
@@ -15,11 +15,11 @@
|
|||||||
"test-watch": "mocha --recursive --require @babel/register --watch test",
|
"test-watch": "mocha --recursive --require @babel/register --watch test",
|
||||||
"lint": "eslint components lib test",
|
"lint": "eslint components lib test",
|
||||||
"devtool": "adb shell input keyevent 82",
|
"devtool": "adb shell input keyevent 82",
|
||||||
"update-version": "./tools/update-version.js",
|
"update-version": "node ./tools/bin/update-version.js",
|
||||||
"build-android-release": "cd android && ./gradlew clean && ./gradlew assembleRelease && cd ..",
|
"commit-release": "node ./tools/bin/commit-release.js",
|
||||||
"commit-release": "./tools/commit-release",
|
"tag-release": "node ./tools/bin/tag-release.js",
|
||||||
"update-changelog": "./tools/update-changelog.js",
|
"update-changelog": "node ./tools/bin/update-changelog.js",
|
||||||
"release": "npm run update-version && npm run build-android-release && npm run commit-release"
|
"release": "node ./tools/release-wizard.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ptomasroos/react-native-multi-slider": "^1.0.0",
|
"@ptomasroos/react-native-multi-slider": "^1.0.0",
|
||||||
|
|||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const makeCommitRelease = require('../commit-release');
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
await makeCommitRelease()
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
})()
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const tagRelease = require('../tag-release');
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
await tagRelease()
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
})()
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const updateChangelog = require('../update-changelog');
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
await updateChangelog()
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
})()
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
const updateVersion = require('../update-version');
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
await updateVersion()
|
||||||
|
} catch(err) {
|
||||||
|
console.error(err)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
})()
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Any copyright is dedicated to the Public Domain.
|
|
||||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
|
||||||
|
|
||||||
set -eEu -o pipefail
|
|
||||||
shopt -s extdebug
|
|
||||||
IFS=$'\n\t'
|
|
||||||
trap 'onFailure $?' ERR
|
|
||||||
|
|
||||||
function onFailure() {
|
|
||||||
echo "Unhandled script error $1 at ${BASH_SOURCE[0]}:${BASH_LINENO[0]}" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
git add -A
|
|
||||||
git commit -m "release: $(cat package.json | $(npm bin)/jase version)"
|
|
||||||
git tag v$(cat package.json | $(npm bin)/jase version)
|
|
||||||
Executable
+14
@@ -0,0 +1,14 @@
|
|||||||
|
const { exec } = require('child_process')
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const version = require('../package.json').version
|
||||||
|
exec('git add -A', err => {
|
||||||
|
if (err) return reject(err.message)
|
||||||
|
exec(`git commit -m "Release: ${version}"`, err => {
|
||||||
|
if (err) return reject(err.message)
|
||||||
|
resolve()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
const readline = require('readline')
|
||||||
|
const updateVersion = require('./update-version')
|
||||||
|
const createTagForRelease = require('./tag-release')
|
||||||
|
const updateChangelog = require('./update-changelog')
|
||||||
|
const makeCommitRelease = require('./commit-release')
|
||||||
|
|
||||||
|
process.on('unhandledRejection', err => { throw(err) })
|
||||||
|
|
||||||
|
async function leadThroughRelease() {
|
||||||
|
console.log("Yay, a release! Let's do this. First, let's update the version everywhere and create a new git tag.")
|
||||||
|
|
||||||
|
await updateVersion()
|
||||||
|
await createTagForRelease()
|
||||||
|
|
||||||
|
const rl = readline.createInterface({
|
||||||
|
input: process.stdin,
|
||||||
|
output: process.stdout,
|
||||||
|
})
|
||||||
|
const shouldUpdateChangelog = await new Promise(resolve => {
|
||||||
|
rl.question('Would you like to update the changelog (y/n)?', yn => {
|
||||||
|
yn === 'y' || yn === 'Y' ? resolve(true) : resolve(false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
if (shouldUpdateChangelog) {
|
||||||
|
await updateChangelog()
|
||||||
|
await new Promise(resolve => {
|
||||||
|
rl.question("Awesome. We've added all commits for this release to the changelog file. Please review, edit and summarize where necessary so it's useful for the app's users. Then come back here and press enter.", () => resolve())
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
await makeCommitRelease()
|
||||||
|
|
||||||
|
console.log(`Groovy. We've created a commit for this release that includes the version and changelog updates, as well as a git tag for the release.
|
||||||
|
Please review it, make any necessary changes, and if it's all good, push the commit and the tag up to master by running:
|
||||||
|
git push origin master
|
||||||
|
git push origin ${require('../package.json').version}
|
||||||
|
|
||||||
|
Don't forget to also run 'npm run build-android-release' to package the apk and upload it to the app stores!
|
||||||
|
`)
|
||||||
|
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
leadThroughRelease()
|
||||||
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
const { exec } = require('child_process')
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const version = require('../package.json').version
|
||||||
|
exec(`git tag v${version}`, err => {
|
||||||
|
if (err) {
|
||||||
|
console.error(`There was a problem creating the new tag. Typically, this happens when it already exists, in which case you can delete it with
|
||||||
|
git tag -d <name of tag>
|
||||||
|
or you might not have made the file executable yet, which you can do by running
|
||||||
|
chmod +x ./tools/tag-release`)
|
||||||
|
reject(err.message)
|
||||||
|
} else {
|
||||||
|
resolve()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
const updateChangelog = require('basic-changelog')
|
const updateChangelog = require('basic-changelog')
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
filterCommitsStartingWith: ['release:']
|
filterCommitsStartingWith: ['release:']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
updateChangelog('./CHANGELOG.md', opts, err => {
|
updateChangelog('./CHANGELOG.md', opts, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error('Something went wrong trying to update the changelog:')
|
console.error('Something went wrong trying to update the changelog:')
|
||||||
console.error(err)
|
reject(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.log('Changelog successfully updated')
|
console.log('Changelog successfully updated')
|
||||||
|
resolve()
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
+12
-13
@@ -1,5 +1,3 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
// from https://gitlab.com/staltz/manyverse/blob/master/tools/update-version.js
|
// from https://gitlab.com/staltz/manyverse/blob/master/tools/update-version.js
|
||||||
|
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
@@ -11,6 +9,9 @@ const leftPad = require('left-pad')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
const currentVersion = JSON.parse(fs.readFileSync('./package.json')).version
|
const currentVersion = JSON.parse(fs.readFileSync('./package.json')).version
|
||||||
|
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
@@ -26,7 +27,7 @@ function createTodaysVersion(attempt) {
|
|||||||
if (attempt === 0) {
|
if (attempt === 0) {
|
||||||
return `0.${yy}${mm}.${d}-beta`
|
return `0.${yy}${mm}.${d}-beta`
|
||||||
} else {
|
} else {
|
||||||
const letter = String.fromCharCode(97 + attempt) // 0=a, 1=b, 2=c, ...
|
const letter = String.fromCharCode(96 + attempt) // 0=a, 1=b, 2=c, ...
|
||||||
return `0.${yy}${mm}.${d}-beta.${letter}`
|
return `0.${yy}${mm}.${d}-beta.${letter}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,14 +38,13 @@ for (let i = 0 /* letter a */; i <= 25 /* letter z */; i++) {
|
|||||||
if (nextVersion !== currentVersion) break
|
if (nextVersion !== currentVersion) break
|
||||||
}
|
}
|
||||||
if (nextVersion === currentVersion) {
|
if (nextVersion === currentVersion) {
|
||||||
console.error('I dont know what else to generate beyong ' + nextVersion)
|
console.error('I dont know what else to generate beyond ' + nextVersion)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
rl.question('Next version will be `' + nextVersion + '`, okay? y/n ', yn => {
|
rl.question('Next version will be `' + nextVersion + '`, okay? y/n ', async yn => {
|
||||||
if (yn !== 'y' && yn !== 'Y') {
|
if (yn !== 'y' && yn !== 'Y') {
|
||||||
console.log('Release cancelled.\n')
|
reject('Release cancelled.\n')
|
||||||
process.exit(1)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,16 +55,15 @@ rl.question('Next version will be `' + nextVersion + '`, okay? y/n ', yn => {
|
|||||||
fs.writeFileSync('./package.json', JSON.stringify(pkgJSON, null, 2))
|
fs.writeFileSync('./package.json', JSON.stringify(pkgJSON, null, 2))
|
||||||
fs.writeFileSync('./package-lock.json', JSON.stringify(pkgLockJSON, null, 2))
|
fs.writeFileSync('./package-lock.json', JSON.stringify(pkgLockJSON, null, 2))
|
||||||
|
|
||||||
ReactNativeVersion.version(
|
await ReactNativeVersion.version(
|
||||||
{
|
{
|
||||||
neverAmend: true,
|
neverAmend: true,
|
||||||
target: 'android',
|
target: 'android',
|
||||||
},
|
},
|
||||||
path.resolve(__dirname, '../'),
|
path.resolve(__dirname, '../'),
|
||||||
).catch(err => {
|
)
|
||||||
console.error(err)
|
|
||||||
process.exit(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
rl.close()
|
rl.close()
|
||||||
|
resolve()
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user