Merge remote-tracking branch 'origin/master' into no-window-frame-for-windows-on-windows

This commit is contained in:
Markus Olsson 2016-06-22 18:43:52 +02:00
commit 67885abff9
6 changed files with 100 additions and 21 deletions

View file

@ -4,21 +4,28 @@
### Node.js
We use some ES6+ language constructs in our build scripts sou need [Node.js](https://nodejs.org) 6+ (just pick whatever the 'current' release is at the moment). Node 6 comes with npm 3 out of the box and while npm 3 isn't strictly necessary to build it does make things more efficient, especially on Windows where deep folder hierarchies can be detrimental to build speed.
We use some ES6+ language constructs in our build scripts so you need [Node.js](https://nodejs.org) 6+ (just pick whatever the 'current' release is at the moment). Node 6 comes with npm 3 out of the box and while npm 3 isn't strictly necessary to build it does make things more efficient, especially on Windows where deep folder hierarchies can be detrimental to build speed.
*Windows only: Make sure you allow the Node.js installer to add node to the PATH, it'll make life much easier for you*
### node-gyp
node-gyp is required to build some of our native npm packages (such as keytar)
node-gyp is required to build some of our native npm packages (such as [keytar](https://github.com/atom/node-keytar))
* Install python 2.7 ([Windows](https://www.python.org/downloads/windows/), [MacOS](https://www.python.org/downloads/mac-osx/))
* **MacOS:** Xcode and Xcode Command Line Tools (Xcode -> Preferences -> Downloads)
* Install python 2.7 ([Windows](https://www.python.org/downloads/windows/), [macOS](https://www.python.org/downloads/mac-osx/))
* **macOS:** Xcode and Xcode Command Line Tools (Xcode -> Preferences -> Downloads)
* **Windows:** Visual Studio 2015 or [Visual C++ Build Tools](http://go.microsoft.com/fwlink/?LinkId=691126)
* Run `npm config set msvs_version 2015` after installing the build tools
* Run `npm install -g node-gyp`
*Windows only*: Let python install into the default suggested path (`c:\Python27`), don't try to move it into Program Files and *let it add python.exe to the path* or else you'll have to configure node-gyp manually with the path.
*Windows only*: Let python install into the default suggested path (`c:\Python27`), don't try to move it into Program Files or else you'll have to configure node-gyp manually with the path.
### Certificates
#### macOS
1. Download the [`developer-id-cert.p12`](https://github.com/desktop/desktop-secrets/blob/master/developer-id-cert.p12) and then open it.
1. Ask a member of the Desktop team for the password.
1. Add it to your Keychain.
## Building

View file

@ -3,7 +3,7 @@
"productName": "GitHub",
"bundleID": "com.github.GitHubClient",
"companyName": "GitHub, Inc.",
"version": "0.0.1",
"version": "0.0.2",
"main": "./app/main-process/main.js",
"repository": {
"type": "git",

View file

@ -32,7 +32,6 @@ const options = {
prune: false, // We only install production dependencies above.
// OS X
// TODO: We'll need to sign this shit.
'app-bundle-id': appPackage.bundleID,
'app-category-type': 'public.app-category.developer-tools',
'protocols': [
@ -43,6 +42,7 @@ const options = {
]
}
],
'osx-sign': true,
// Windows
'version-string': {
@ -54,6 +54,10 @@ const options = {
}
}
if (process.platform === 'darwin' && process.env.TRAVIS_BRANCH) {
cp.execSync(path.join(__dirname, 'setup-macos-keychain'))
}
packager(options, (error, appPaths) => {
if (error) {
console.error(error)

View file

@ -13,6 +13,10 @@ function getProductName () {
return appPackage.productName
}
function getName () {
return appPackage.name
}
function getCompanyName () {
return appPackage.companyName
}
@ -21,14 +25,52 @@ function getVersion () {
return appPackage.version
}
function getOSXZipPath () {
function getOSXZipName () {
const productName = getProductName()
return path.join(getDistPath(), '..', `${productName}.zip`)
return `${productName}.zip`
}
function getOSXZipPath () {
return path.join(getDistPath(), '..', getOSXZipName())
}
function getWindowsInstallerName () {
const productName = getProductName()
return `${productName}Setup.msi`
}
function getWindowsInstallerPath () {
const productName = getProductName()
return path.join(getDistPath(), '..', 'installer', `${productName}Setup.msi`)
return path.join(getDistPath(), '..', 'installer', getWindowsInstallerName())
}
module.exports = {getDistPath, getProductName, getCompanyName, getVersion, getOSXZipPath, getWindowsInstallerPath}
function getWindowsStandaloneName () {
const productName = getProductName()
return `${productName}Setup.exe`
}
function getWindowsStandalonePath () {
return path.join(getDistPath(), '..', 'installer', getWindowsStandaloneName())
}
function getWindowsFullNugetPackageName () {
return `${getName()}-${getVersion()}-full.nupkg`
}
function getWindowsFullNugetPackagePath () {
return path.join(getDistPath(), '..', 'installer', getWindowsFullNugetPackageName())
}
module.exports = {
getDistPath,
getProductName,
getCompanyName,
getVersion,
getOSXZipName,
getOSXZipPath,
getWindowsInstallerName,
getWindowsInstallerPath,
getWindowsStandaloneName,
getWindowsStandalonePath,
getWindowsFullNugetPackageName,
getWindowsFullNugetPackagePath
}

View file

@ -48,9 +48,9 @@ if (process.platform === 'darwin') {
}
uploadPromise
.then(({url, name}) => {
console.log(`Uploaded ${name} to ${url}`)
return updateDeploy([{url, name}])
.then(artifacts => {
console.log(`Uploaded artifacts: ${artifacts}`)
return updateDeploy(artifacts)
})
.catch(e => {
console.error(`Publishing failed: ${e}`)
@ -58,13 +58,19 @@ uploadPromise
})
function uploadOSXAssets () {
const name = `${distInfo.getProductName()}.zip`
return upload(name, distInfo.getOSXZipPath()).then(url => ({url, name}))
const uploads = [
upload(distInfo.getOSXZipName(), distInfo.getOSXZipPath())
]
return Promise.all(uploads)
}
function uploadWindowsAssets () {
const name = `${distInfo.getProductName()}Setup.msi`
return upload(name, distInfo.getWindowsInstallerPath()).then(url => ({url, name}))
const uploads = [
upload(distInfo.getWindowsInstallerName(), distInfo.getWindowsInstallerPath()),
upload(distInfo.getWindowsStandaloneName(), distInfo.getWindowsStandalonePath()),
upload(distInfo.getWindowsFullNugetPackageName(), distInfo.getWindowsFullNugetPackagePath())
]
return Promise.all(uploads)
}
function upload (assetName, assetPath) {
@ -87,7 +93,16 @@ function upload (assetName, assetPath) {
if (error) {
reject(error)
} else {
resolve(url)
const stats = fs.statSync(assetPath)
const hash = crypto.createHash('sha1')
const input = fs.createReadStream(assetPath)
hash.on('finish', () => {
const sha = hash.read().toString('hex')
resolve({name: assetName, url, size: stats['size'], sha})
})
input.pipe(hash)
}
})
})

11
script/setup-macos-keychain Executable file
View file

@ -0,0 +1,11 @@
#!/bin/sh
curl -H "Authorization: token ${DESKTOPBOT_TOKEN}" -H 'Accept: application/vnd.github.v3.raw' -O -L https://api.github.com/repos/desktop/desktop-secrets/contents/developer-id-cert.p12
KEY_CHAIN=mac-build.keychain
security create-keychain -p travis $KEY_CHAIN
security default-keychain -s $KEY_CHAIN
security unlock-keychain -p travis $KEY_CHAIN
security set-keychain-settings -t 3600 -u $KEY_CHAIN
security import developer-id-cert.p12 -k $KEY_CHAIN -P $KEY_PASSWORD -T /usr/bin/codesign