Skip to content

Commit

Permalink
Merge pull request #12249 from electron/auto-release-updates
Browse files Browse the repository at this point in the history
Auto release updates
  • Loading branch information
John Kleinschmidt committed Mar 14, 2018
2 parents e8a7cc5 + c9e5d17 commit f48f486
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 32 deletions.
102 changes: 87 additions & 15 deletions .circleci/config.yml
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
electron-linux-arm:
docker:
- image: electronbuilds/electron:0.0.6
- image: electronbuilds/electron:0.0.7
environment:
TARGET_ARCH: arm
resource_class: 2xlarge
Expand Down Expand Up @@ -63,23 +63,19 @@ jobs:
shell: /bin/sh
command: |
if [ "$ELECTRON_RELEASE" == "1" ] && [ "$AUTO_RELEASE" == "true" ]; then
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 8
nvm use 8
echo 'Trying to finish release'
node script/release.js --automaticRelease
releaseExitCode=$?
if [ $? -eq 0 ]; then
if [ $releaseExitCode -eq 0 ]; then
echo 'Release successful, now publishing to npm'
echo "//registry.npmjs.org/:_authToken=$ELECTRON_NPM_TOKEN" >> ~/.npmrc
nvm use system
npm run publish
npm run publish-to-npm
echo 'Release has been published to npm'
else
echo 'Release is not complete, skipping publish for now.'
echo 'Release is not complete, skipping publish for now'
fi
else
echo 'Skipping release check'
echo 'Skipping finishing release because build is not for release'
fi
- run:
name: Zip out directory
Expand Down Expand Up @@ -119,7 +115,7 @@ jobs:
fi
electron-linux-arm64:
docker:
- image: electronbuilds/electron:0.0.6
- image: electronbuilds/electron:0.0.7
environment:
TARGET_ARCH: arm64
resource_class: 2xlarge
Expand Down Expand Up @@ -174,6 +170,25 @@ jobs:
else
echo 'Skipping upload distribution because build is not for release'
fi
- run:
name: Optionally finish release
shell: /bin/sh
command: |
if [ "$ELECTRON_RELEASE" == "1" ] && [ "$AUTO_RELEASE" == "true" ]; then
echo 'Trying to finish release'
node script/release.js --automaticRelease
releaseExitCode=$?
if [ $releaseExitCode -eq 0 ]; then
echo 'Release successful, now publishing to npm'
echo "//registry.npmjs.org/:_authToken=$ELECTRON_NPM_TOKEN" >> ~/.npmrc
npm run publish-to-npm
echo 'Release has been published to npm'
else
echo 'Release is not complete, skipping publish for now'
fi
else
echo 'Skipping finishing release because build is not for release'
fi
- run:
name: Zip out directory
command: |
Expand Down Expand Up @@ -212,7 +227,7 @@ jobs:
fi
electron-linux-ia32:
docker:
- image: electronbuilds/electron:0.0.4
- image: electronbuilds/electron:0.0.7
environment:
TARGET_ARCH: ia32
DISPLAY: ':99.0'
Expand Down Expand Up @@ -271,6 +286,25 @@ jobs:
else
echo 'Skipping upload distribution because build is not for release'
fi
- run:
name: Optionally finish release
shell: /bin/sh
command: |
if [ "$ELECTRON_RELEASE" == "1" ] && [ "$AUTO_RELEASE" == "true" ]; then
echo 'Trying to finish release'
node script/release.js --automaticRelease
releaseExitCode=$?
if [ $releaseExitCode -eq 0 ]; then
echo 'Release successful, now publishing to npm'
echo "//registry.npmjs.org/:_authToken=$ELECTRON_NPM_TOKEN" >> ~/.npmrc
npm run publish-to-npm
echo 'Release has been published to npm'
else
echo 'Release is not complete, skipping publish for now'
fi
else
echo 'Skipping finishing release because build is not for release'
fi
- run:
name: Test
environment:
Expand All @@ -296,7 +330,7 @@ jobs:
fi
electron-linux-mips64el:
docker:
- image: electronbuilds/electron:0.0.6
- image: electronbuilds/electron:0.0.7
environment:
TARGET_ARCH: mips64el
resource_class: xlarge
Expand Down Expand Up @@ -351,10 +385,29 @@ jobs:
else
echo 'Skipping upload distribution because build is not for release'
fi
- run:
name: Optionally finish release
shell: /bin/sh
command: |
if [ "$ELECTRON_RELEASE" == "1" ] && [ "$AUTO_RELEASE" == "true" ]; then
echo 'Trying to finish release'
node script/release.js --automaticRelease
releaseExitCode=$?
if [ $releaseExitCode -eq 0 ]; then
echo 'Release successful, now publishing to npm'
echo "//registry.npmjs.org/:_authToken=$ELECTRON_NPM_TOKEN" >> ~/.npmrc
npm run publish-to-npm
echo 'Release has been published to npm'
else
echo 'Release is not complete, skipping publish for now'
fi
else
echo 'Skipping finishing release because build is not for release'
fi
electron-linux-x64:
docker:
- image: electronbuilds/electron:0.0.6
- image: electronbuilds/electron:0.0.7
environment:
TARGET_ARCH: x64
DISPLAY: ':99.0'
Expand Down Expand Up @@ -413,6 +466,25 @@ jobs:
else
echo 'Skipping upload distribution because build is not for release'
fi
- run:
name: Optionally finish release
shell: /bin/sh
command: |
if [ "$ELECTRON_RELEASE" == "1" ] && [ "$AUTO_RELEASE" == "true" ]; then
echo 'Trying to finish release'
node script/release.js --automaticRelease
releaseExitCode=$?
if [ $releaseExitCode -eq 0 ]; then
echo 'Release successful, now publishing to npm'
echo "//registry.npmjs.org/:_authToken=$ELECTRON_NPM_TOKEN" >> ~/.npmrc
npm run publish-to-npm
echo 'Release has been published to npm'
else
echo 'Release is not complete, skipping publish for now'
fi
else
echo 'Skipping finishing release because build is not for release'
fi
- run:
name: Test
environment:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -7,7 +7,7 @@ ENV HOME=/home
RUN chmod a+rwx /home

# Install node.js
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get update && apt-get install -y nodejs

# Install wget used by crash reporter
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.arm64v8
Expand Up @@ -46,7 +46,7 @@ RUN apt-get update && apt-get install -y\
xvfb

# Install node.js
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get update && apt-get install -y nodejs

# Install crcmod
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.circleci
Expand Up @@ -3,7 +3,7 @@ FROM electronbuilds/libchromiumcontent:0.0.4
USER root

# Install node.js
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get update && apt-get install -y nodejs

# Install wget used by crash reporter
Expand Down
2 changes: 1 addition & 1 deletion script/ci-release-build.js
Expand Up @@ -7,7 +7,7 @@ const circleCIJobs = [
'electron-linux-arm',
'electron-linux-arm64',
'electron-linux-ia32',
'electron-linux-mips64el',
// 'electron-linux-mips64el',
'electron-linux-x64'
]

Expand Down
50 changes: 39 additions & 11 deletions script/prepare-release.js
Expand Up @@ -78,8 +78,10 @@ async function getReleaseNotes (currentBranch) {
base: `v${pkg.version}`,
head: currentBranch
}
let releaseNotes = ''
if (!args.automaticRelease) {
let releaseNotes
if (args.automaticRelease) {
releaseNotes = '## Bug Fixes/Changes \n\n'
} else {
releaseNotes = '(placeholder)\n'
}
console.log(`Checking for commits from ${pkg.version} to ${currentBranch}`)
Expand All @@ -95,19 +97,40 @@ async function getReleaseNotes (currentBranch) {
`${currentBranch}, skipping release.`)
process.exit(0)
}

let prCount = 0
const mergeRE = /Merge pull request #(\d+) from .*\n/
const newlineRE = /(.*)\n*.*/
const prRE = /(.* )\(#(\d+)\)(?:.*)/
commitComparison.data.commits.forEach(commitEntry => {
let commitMessage = commitEntry.commit.message
if (commitMessage.toLowerCase().indexOf('merge') > -1) {
let mergeRE = /Merge pull request (#\d+) from .*\n/
if (commitMessage.indexOf('#') > -1) {
let prMatch = commitMessage.match(mergeRE)
commitMessage = commitMessage.replace(mergeRE, '').replace('\n', '')
if (commitMessage.substr(commitMessage.length - 1, commitMessage.length) !== '.') {
commitMessage += '.'
let prNumber
if (prMatch) {
commitMessage = commitMessage.replace(mergeRE, '').replace('\n', '')
let newlineMatch = commitMessage.match(newlineRE)
if (newlineMatch) {
commitMessage = newlineMatch[1]
}
prNumber = prMatch[1]
} else {
prMatch = commitMessage.match(prRE)
if (prMatch) {
commitMessage = prMatch[1].trim()
prNumber = prMatch[2]
}
}
if (prMatch) {
if (commitMessage.substr(commitMessage.length - 1, commitMessage.length) !== '.') {
commitMessage += '.'
}
releaseNotes += `* ${commitMessage} #${prNumber} \n\n`
prCount++
}
releaseNotes += `${commitMessage} ${prMatch[1]} \n\n`
}
})
console.log(`${pass} Done generating release notes for ${currentBranch}.`)
console.log(`${pass} Done generating release notes for ${currentBranch}. Found ${prCount} PRs.`)
return releaseNotes
}

Expand Down Expand Up @@ -187,7 +210,12 @@ async function tagRelease (version) {

async function verifyNewVersion () {
let newVersion = getNewVersion(true)
let response = await promptForVersion(newVersion)
let response
if (args.automaticRelease) {
response = 'y'
} else {
response = await promptForVersion(newVersion)
}
if (response.match(/^y/i)) {
console.log(`${pass} Starting release of ${newVersion}`)
} else {
Expand Down Expand Up @@ -218,7 +246,7 @@ async function prepareRelease (isBeta, notesOnly) {
let currentBranch = await getCurrentBranch(gitDir)
if (notesOnly) {
let releaseNotes = await getReleaseNotes(currentBranch)
console.log(`Draft release notes are: ${releaseNotes}`)
console.log(`Draft release notes are: \n${releaseNotes}`)
} else {
await verifyNewVersion()
await createRelease(currentBranch, isBeta)
Expand Down
4 changes: 2 additions & 2 deletions script/release.js
Expand Up @@ -97,7 +97,7 @@ function assetsForVersion (version, validatingRelease) {
`electron-${version}-linux-armv7l.zip`,
`electron-${version}-linux-ia32-symbols.zip`,
`electron-${version}-linux-ia32.zip`,
`electron-${version}-linux-mips64el.zip`,
// `electron-${version}-linux-mips64el.zip`,
`electron-${version}-linux-x64-symbols.zip`,
`electron-${version}-linux-x64.zip`,
`electron-${version}-mas-x64-dsym.zip`,
Expand All @@ -116,7 +116,7 @@ function assetsForVersion (version, validatingRelease) {
`ffmpeg-${version}-linux-arm64.zip`,
`ffmpeg-${version}-linux-armv7l.zip`,
`ffmpeg-${version}-linux-ia32.zip`,
`ffmpeg-${version}-linux-mips64el.zip`,
// `ffmpeg-${version}-linux-mips64el.zip`,
`ffmpeg-${version}-linux-x64.zip`,
`ffmpeg-${version}-mas-x64.zip`,
`ffmpeg-${version}-win32-ia32.zip`,
Expand Down

0 comments on commit f48f486

Please sign in to comment.