mirror of
https://github.com/desktop/desktop
synced 2024-11-05 20:49:32 +00:00
Merge branch 'master' into oauth
This commit is contained in:
commit
a7adb223ae
7 changed files with 129 additions and 7 deletions
|
@ -9,6 +9,7 @@ os:
|
|||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^__release-.*/
|
||||
|
||||
language: node_js
|
||||
node_js:
|
||||
|
@ -35,3 +36,6 @@ script:
|
|||
- npm run lint
|
||||
- npm run build:prod
|
||||
- npm test
|
||||
|
||||
after_success:
|
||||
- node script/publish
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
environment:
|
||||
nodejs_version: "5"
|
||||
|
||||
cache:
|
||||
- node_modules
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /^__release-.*/
|
||||
|
||||
skip_tags: true
|
||||
|
||||
|
@ -20,5 +24,5 @@ build_script:
|
|||
test_script:
|
||||
- npm test
|
||||
|
||||
cache:
|
||||
- node_modules
|
||||
on_success:
|
||||
- node script/publish
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
"webpack-hot-middleware": "^2.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"aws-sdk": "^2.3.15",
|
||||
"babel-core": "^6.7.6",
|
||||
"babel-loader": "^6.2.4",
|
||||
"babel-plugin-react-transform": "^2.0.2",
|
||||
|
|
|
@ -5,14 +5,30 @@ const path = require('path')
|
|||
const projectRoot = path.join(__dirname, '..')
|
||||
const appPackage = require(path.join(projectRoot, 'package.json'))
|
||||
|
||||
module.exports.getDistPath = function () {
|
||||
function getDistPath () {
|
||||
return path.join(projectRoot, 'dist', `${appPackage.productName}-${process.platform}-x64`)
|
||||
}
|
||||
|
||||
module.exports.getProductName = function () {
|
||||
function getProductName () {
|
||||
return appPackage.productName
|
||||
}
|
||||
|
||||
module.exports.getCompanyName = function () {
|
||||
function getCompanyName () {
|
||||
return appPackage.companyName
|
||||
}
|
||||
|
||||
function getVersion () {
|
||||
return appPackage.version
|
||||
}
|
||||
|
||||
function getOSXZipPath () {
|
||||
const productName = getProductName()
|
||||
return path.join(getDistPath(), '..', `${productName}.zip`)
|
||||
}
|
||||
|
||||
function getWindowsInstallerPath () {
|
||||
const productName = getProductName()
|
||||
return path.join(getDistPath(), '..', 'installer', `${productName}Setup.msi`)
|
||||
}
|
||||
|
||||
module.exports = {getDistPath, getProductName, getCompanyName, getVersion, getOSXZipPath, getWindowsInstallerPath}
|
||||
|
|
|
@ -20,7 +20,7 @@ if (process.platform === 'darwin') {
|
|||
}
|
||||
|
||||
function packageOSX () {
|
||||
const dest = path.join(distPath, '..', `${productName}.zip`)
|
||||
const dest = distInfo.getOSXZipPath()
|
||||
fs.removeSync(dest)
|
||||
|
||||
cp.execSync(`ditto -ck --keepParent ${distPath}/${productName}.app ${dest}`)
|
||||
|
|
94
script/publish
Normal file
94
script/publish
Normal file
|
@ -0,0 +1,94 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict'
|
||||
|
||||
const TEST_PUBLISH = false
|
||||
|
||||
let branchName = ''
|
||||
if (process.platform === 'darwin') {
|
||||
branchName = process.env.TRAVIS_BRANCH
|
||||
} else if (process.platform === 'win32') {
|
||||
branchName = process.env.APPVEYOR_REPO_BRANCH
|
||||
}
|
||||
|
||||
if (!/^__release.*/.test(branchName) && !TEST_PUBLISH) {
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
const fs = require('fs')
|
||||
const cp = require('child_process')
|
||||
const AWS = require('aws-sdk')
|
||||
const distInfo = require('./dist-info')
|
||||
|
||||
console.log('Packaging…')
|
||||
cp.execSync('npm run package')
|
||||
|
||||
let sha = ''
|
||||
if (process.platform === 'darwin') {
|
||||
sha = process.env.TRAVIS_COMMIT
|
||||
} else if (process.platform === 'win32') {
|
||||
sha = process.env.APPVEYOR_REPO_COMMIT
|
||||
}
|
||||
|
||||
sha = sha.substr(0, 8)
|
||||
|
||||
console.log('Uploading…')
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
uploadOSXAssets()
|
||||
} else if (process.platform === 'win32') {
|
||||
uploadWindowsAssets()
|
||||
} else {
|
||||
console.error(`I dunno how to publish a release for ${process.platform} :(`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
function uploadOSXAssets () {
|
||||
const name = `${distInfo.getProductName()}.zip`
|
||||
upload(name, distInfo.getOSXZipPath())
|
||||
.then(url => {
|
||||
console.log(`Uploaded ${name} to ${url}`)
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(`Uploading ${name} failed: ${e}`)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
|
||||
function uploadWindowsAssets () {
|
||||
const name = `${distInfo.getProductName()}Setup.msi`
|
||||
upload(name, distInfo.getWindowsInstallerPath())
|
||||
.then(url => {
|
||||
console.log(`Uploaded ${name} to ${url}`)
|
||||
})
|
||||
.catch(e => {
|
||||
console.error(`Uploading ${name} failed: ${e}`)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
|
||||
function upload (assetName, assetPath) {
|
||||
const s3Info = {accessKeyId: process.env.S3_KEY, secretAccessKey: process.env.S3_SECRET}
|
||||
const s3 = new AWS.S3(s3Info)
|
||||
|
||||
const bucket = process.env.S3_BUCKET
|
||||
const key = `releases/${distInfo.getVersion()}-${sha}/${assetName}`
|
||||
const url = `https://s3.amazonaws.com/${bucket}/${key}`
|
||||
|
||||
const uploadParams = {
|
||||
Bucket: bucket,
|
||||
ACL: 'public-read',
|
||||
Key: key,
|
||||
Body: fs.createReadStream(assetPath)
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
s3.upload(uploadParams, (error, data) => {
|
||||
if (error) {
|
||||
reject(error)
|
||||
} else {
|
||||
resolve(url)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
|
@ -25,6 +25,10 @@ export default class AppWindow {
|
|||
|
||||
public load() {
|
||||
let startLoad: number = null
|
||||
this.window.webContents.on('did-start-loading', () => {
|
||||
startLoad = Date.now()
|
||||
})
|
||||
|
||||
this.window.webContents.on('did-finish-load', () => {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.window.webContents.openDevTools()
|
||||
|
@ -41,7 +45,6 @@ export default class AppWindow {
|
|||
this.window.show()
|
||||
})
|
||||
|
||||
startLoad = Date.now()
|
||||
this.window.loadURL(`file://${__dirname}/../../static/index.html`)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue