Browse Source

Merge pull request #12249 from electron/auto-release-updates

Auto release updates
John Kleinschmidt 7 years ago
parent
commit
f48f486412
7 changed files with 132 additions and 32 deletions
  1. 87 15
      .circleci/config.yml
  2. 1 1
      Dockerfile
  3. 1 1
      Dockerfile.arm64v8
  4. 1 1
      Dockerfile.circleci
  5. 1 1
      script/ci-release-build.js
  6. 39 11
      script/prepare-release.js
  7. 2 2
      script/release.js

+ 87 - 15
.circleci/config.yml

@@ -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
@@ -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
@@ -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
@@ -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: |
@@ -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'
@@ -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:
@@ -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
@@ -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'
@@ -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:

+ 1 - 1
Dockerfile

@@ -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

+ 1 - 1
Dockerfile.arm64v8

@@ -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

+ 1 - 1
Dockerfile.circleci

@@ -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

+ 1 - 1
script/ci-release-build.js

@@ -7,7 +7,7 @@ const circleCIJobs = [
   'electron-linux-arm',
   'electron-linux-arm64',
   'electron-linux-ia32',
-  'electron-linux-mips64el',
+//  'electron-linux-mips64el',
   'electron-linux-x64'
 ]
 

+ 39 - 11
script/prepare-release.js

@@ -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}`)
@@ -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
 }
 
@@ -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 {
@@ -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)

+ 2 - 2
script/release.js

@@ -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`,
@@ -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`,