mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 07:28:08 +03:00
Compress artifacts when passing --compress-artifacts to script/build
This commit is contained in:
parent
2db3ee9ee9
commit
6d803ed3a4
@ -25,10 +25,9 @@ install:
|
||||
- nvm use --delete-prefix $NODE_VERSION
|
||||
- npm install -g npm
|
||||
- script/bootstrap
|
||||
- script/build
|
||||
- script/build --compress-artifacts
|
||||
|
||||
script:
|
||||
- echo 'Run tests at some point.'
|
||||
script: false
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
@ -25,7 +25,7 @@ install:
|
||||
build_script:
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
- script\bootstrap.cmd
|
||||
- script\build.cmd --code-sign
|
||||
- script\build.cmd --code-sign --compress-artifacts
|
||||
|
||||
test: off
|
||||
deploy: off
|
||||
@ -34,6 +34,8 @@ artifacts:
|
||||
name: AtomSetup.exe
|
||||
- path: out\AtomSetup.msi
|
||||
name: AtomSetup.msi
|
||||
- path: out\atom-windows.zip
|
||||
name: atom-windows.zip
|
||||
- path: out\RELEASES
|
||||
name: RELEASES
|
||||
- path: out\atom-*-delta.nupkg
|
||||
|
@ -22,11 +22,7 @@ dependencies:
|
||||
|
||||
override:
|
||||
- script/bootstrap
|
||||
- script/build --code-sign
|
||||
|
||||
post:
|
||||
- cd out && zip -r ./atom-mac.zip ./Atom.app
|
||||
- cd out && zip -r ./atom-mac-symbols.zip ./symbols
|
||||
- script/build --code-sign --compress-artifacts
|
||||
|
||||
cache_directories:
|
||||
- cache
|
||||
|
@ -9,6 +9,7 @@ require('colors')
|
||||
const argv = require('yargs').argv
|
||||
const cleanOutputDirectory = require('./lib/clean-output-directory')
|
||||
const codeSignOnMac = require('./lib/code-sign-on-mac')
|
||||
const compressArtifacts = require('./lib/compress-artifacts')
|
||||
const copyAssets = require('./lib/copy-assets')
|
||||
const createWindowsInstaller = require('./lib/create-windows-installer')
|
||||
const dumpSymbols = require('./lib/dump-symbols')
|
||||
@ -52,6 +53,12 @@ dumpSymbols()
|
||||
return createWindowsInstaller(packagedAppPath, argv.codeSign).then(() => packagedAppPath)
|
||||
}
|
||||
}).then(packagedAppPath => {
|
||||
if (argv.compressArtifacts) {
|
||||
compressArtifacts(packagedAppPath)
|
||||
} else {
|
||||
console.log('Skipping artifacts compression. Specify the --compress-artifacts option to compress Atom binaries (and symbols on macOS)'.gray)
|
||||
}
|
||||
|
||||
if (argv.install) {
|
||||
installApplication(packagedAppPath)
|
||||
} else {
|
||||
|
47
script/lib/compress-artifacts.js
Normal file
47
script/lib/compress-artifacts.js
Normal file
@ -0,0 +1,47 @@
|
||||
'use strict'
|
||||
|
||||
const childProcess = require('child_process')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
|
||||
const CONFIG = require('../config')
|
||||
|
||||
module.exports = function (packagedAppPath) {
|
||||
let appArchiveName
|
||||
if (process.platform === 'darwin') {
|
||||
appArchiveName = 'atom-mac.zip'
|
||||
} else if (process.platform === 'win32') {
|
||||
appArchiveName = 'atom-windows.zip'
|
||||
} else {
|
||||
appArchiveName = 'atom-amd64.tar.gz'
|
||||
}
|
||||
const appArchivePath = path.join(CONFIG.buildOutputPath, appArchiveName)
|
||||
compress(packagedAppPath, appArchivePath)
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
const symbolsArchivePath = path.join(CONFIG.buildOutputPath, 'atom-mac-symbols.zip')
|
||||
compress(CONFIG.symbolsPath, symbolsArchivePath)
|
||||
}
|
||||
}
|
||||
|
||||
function compress (inputDirPath, outputArchivePath) {
|
||||
if (fs.existsSync(outputArchivePath)) {
|
||||
console.log(`Deleting "${outputArchivePath}"`)
|
||||
fs.removeSync(outputArchivePath)
|
||||
}
|
||||
|
||||
console.log(`Compressing "${inputDirPath}" to "${outputArchivePath}"`)
|
||||
let compressCommand, compressArguments
|
||||
if (process.platform === 'darwin') {
|
||||
compressCommand = 'zip'
|
||||
compressArguments = ['-r', '--symlinks']
|
||||
} else if (process.platform === 'win32') {
|
||||
compressCommand = '7z.exe'
|
||||
compressArguments = ['a', '-r']
|
||||
} else {
|
||||
compressCommand = 'tar'
|
||||
compressArguments = ['caf']
|
||||
}
|
||||
compressArguments.push(outputArchivePath, path.basename(inputDirPath))
|
||||
childProcess.spawnSync(compressCommand, compressArguments, {cwd: path.dirname(inputDirPath)})
|
||||
}
|
Loading…
Reference in New Issue
Block a user