diff --git a/jenkins/Jenkinsfile.darwin b/jenkins/Jenkinsfile.darwin new file mode 100644 index 00000000..6ca5eb0d --- /dev/null +++ b/jenkins/Jenkinsfile.darwin @@ -0,0 +1,24 @@ +pipeline { + agent { + node { + label 'master' + } + } + stages { + stage('Build') { + environment { + ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES = 1 + } + steps { + sh 'rm -rf node_modules' + sh 'npm install' + sh 'npm run jenkins:build:mac' + } + } + stage('Upload') { + steps { + sh 'npm run jenkins:upload' + } + } + } +} \ No newline at end of file diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile.linux.develop similarity index 83% rename from jenkins/Jenkinsfile rename to jenkins/Jenkinsfile.linux.develop index fad1505b..faec7963 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile.linux.develop @@ -3,7 +3,7 @@ pipeline { dockerfile { filename 'Dockerfile' dir 'jenkins/Docker' - args '--env ETH_SIGNING_KEY=$ETH_SIGNING_KEY --env S3_BUCKET_NAME=$S3_BUCKET_NAME' + args '--env ETH_SIGNING_KEY=$ETH_SIGNING_KEY --env S3_BUCKET_NAME=$S3_BUCKET_NAME --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY' } } stages { diff --git a/jenkins/Jenkinsfile.linux.master b/jenkins/Jenkinsfile.linux.master new file mode 100644 index 00000000..8309b680 --- /dev/null +++ b/jenkins/Jenkinsfile.linux.master @@ -0,0 +1,26 @@ +pipeline { + agent { + dockerfile { + filename 'Dockerfile' + dir 'jenkins/Docker' + args '--env ETH_SIGNING_KEY=$ETH_SIGNING_KEY --env S3_BUCKET_NAME=$S3_BUCKET_NAME --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY --env CSC_LINK=$CSC_LINK --env CSC_KEY_PASSWORD=$CSC_KEY_PASSWORD' + } + } + stages { + stage('Build') { + environment { + ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES = 1 + } + steps { + sh 'rm -rf node_modules' + sh 'npm install' + sh 'npm run jenkins:build:linux' + } + } + stage('Upload') { + steps { + sh 'npm run jenkins:upload' + } + } + } +} \ No newline at end of file diff --git a/jenkins/constants.js b/jenkins/constants.js index 8758cc06..1f990c46 100644 --- a/jenkins/constants.js +++ b/jenkins/constants.js @@ -4,7 +4,7 @@ const GIT_COMMIT_SHORT = GIT_COMMIT.substring(0, 7); const JENKINS_BUILD_ID = process.env.BUILD_ID; const LINUX_FILES = [`MyCrypto-${VERSION}-i386.AppImage`, `MyCrypto-${VERSION}-x86_64.AppImage`]; const WINDOWS_FILES = [`MyCrypto Setup ${VERSION}.exe`, `MyCrypto Setup ${VERSION}.exe.blockmap`]; -const OSX_FILES = []; +const OSX_FILES = [`MyCrypto-${VERSION}-mac.zip`, `MyCrypto-${VERSION}.dmg`, `MyCrypto-${VERSION}.dmg.blockmap`]; const FLAVOR = (() => { const { platform } = process; @@ -18,6 +18,7 @@ const FLAVOR = (() => { })(); const S3_BUCKET = process.env.S3_BUCKET_NAME; const ETH_SIGNING_KEY = process.env.ETH_SIGNING_KEY; +const IS_CODE_SIGNING = process.env.CSC_LINK && process.env.CSC_KEY_PASSWORD; module.exports = { VERSION, @@ -29,5 +30,6 @@ module.exports = { OSX_FILES, FLAVOR, S3_BUCKET, - ETH_SIGNING_KEY + ETH_SIGNING_KEY, + IS_CODE_SIGNING }; diff --git a/jenkins/lib.js b/jenkins/lib.js index ff5d144c..6ddefa3e 100644 --- a/jenkins/lib.js +++ b/jenkins/lib.js @@ -5,9 +5,15 @@ const { spawn } = require('child_process'); const { hashPersonalMessage, ecsign, toBuffer, addHexPrefix } = require('ethereumjs-util'); -const genCommitFilename = (name, version, commit, buildId) => { +const genCommitFilename = (name, version, commit, buildId, isCodeSigning) => { + const winRegex = /exe$/; + const macRegex = /dmg$/; const split = name.split(version); - return `${split[0]}${version}-${commit}-${buildId}${split[1]}`; + const signed = winRegex.test(name) || macRegex.test(name) + ? isCodeSigning ? '-signed' : '-unsigned' + : ''; + + return `${split[0]}${version}-${commit}-${buildId}${signed}${split[1]}`; }; const genFileList = (linux, windows, osx) => { @@ -70,10 +76,10 @@ const genSignatureFile = (manifestHash, pKeyString) => { const genSignatureFilename = (flavor, version, commit, buildId) => `manifest.${flavor}.v${version}.${commit}.${buildId}.signature`; -const genManifest = (fileList, version, jenkinsBuildId, gitCommit, gitCommitShort, s3Bucket) => +const genManifest = (fileList, version, jenkinsBuildId, gitCommit, gitCommitShort, s3Bucket, isCodeSigning) => fileList.map(filename => { const fullPath = path.resolve('dist/electron-builds/', filename); - const commitFilename = genCommitFilename(filename, version, gitCommitShort, jenkinsBuildId); + const commitFilename = genCommitFilename(filename, version, gitCommitShort, jenkinsBuildId, isCodeSigning); return { fullPath, diff --git a/jenkins/upload.js b/jenkins/upload.js index 163a1c25..b69008da 100644 --- a/jenkins/upload.js +++ b/jenkins/upload.js @@ -11,7 +11,8 @@ const { OSX_FILES, S3_BUCKET, JENKINS_BUILD_ID, - ETH_SIGNING_KEY + ETH_SIGNING_KEY, + IS_CODE_SIGNING } = require('./constants'); const { @@ -35,7 +36,8 @@ const manifest = genManifest( JENKINS_BUILD_ID, GIT_COMMIT, GIT_COMMIT_SHORT, - S3_BUCKET + S3_BUCKET, + IS_CODE_SIGNING ); const manifestFile = genManifestFile(manifest);