mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-18 21:27:51 +00:00
Build standalone zips into a separate folder
This commit is contained in:
parent
778c39d947
commit
2c66280b3f
2
.gitignore
vendored
2
.gitignore
vendored
@ -36,4 +36,4 @@ resinrc.yml
|
|||||||
/tmp
|
/tmp
|
||||||
build/
|
build/
|
||||||
build-bin/
|
build-bin/
|
||||||
resin-cli-*.zip
|
build-zip/
|
||||||
|
@ -2,18 +2,20 @@ import * as Promise from 'bluebird';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as fs from 'fs-extra';
|
import * as fs from 'fs-extra';
|
||||||
|
import * as mkdirp from 'mkdirp';
|
||||||
import * as publishRelease from 'publish-release';
|
import * as publishRelease from 'publish-release';
|
||||||
import * as archiver from 'archiver';
|
import * as archiver from 'archiver';
|
||||||
|
|
||||||
const publishReleaseAsync = Promise.promisify(publishRelease);
|
const publishReleaseAsync = Promise.promisify(publishRelease);
|
||||||
|
const mkdirpAsync = Promise.promisify<string | null, string>(mkdirp);
|
||||||
|
|
||||||
const { GITHUB_TOKEN } = process.env;
|
const { GITHUB_TOKEN } = process.env;
|
||||||
const ROOT = path.join(__dirname, '..');
|
const ROOT = path.join(__dirname, '..');
|
||||||
|
|
||||||
const version = 'v' + require('../package.json').version;
|
const version = 'v' + require('../package.json').version;
|
||||||
const outputFile = path.join(ROOT, `resin-cli-${version}-${os.platform()}-${os.arch()}.zip`);
|
const outputFile = path.join(ROOT, 'build-zip', `resin-cli-${version}-${os.platform()}-${os.arch()}.zip`);
|
||||||
|
|
||||||
new Promise((resolve, reject) => {
|
mkdirpAsync(path.dirname(outputFile)).then(() => new Promise((resolve, reject) => {
|
||||||
console.log('Zipping build...');
|
console.log('Zipping build...');
|
||||||
|
|
||||||
let archive = archiver('zip', {
|
let archive = archiver('zip', {
|
||||||
@ -31,12 +33,12 @@ new Promise((resolve, reject) => {
|
|||||||
|
|
||||||
archive.pipe(outputStream);
|
archive.pipe(outputStream);
|
||||||
archive.finalize();
|
archive.finalize();
|
||||||
}).then(() => {
|
})).then(() => {
|
||||||
console.log('Build zipped');
|
console.log('Build zipped');
|
||||||
console.log('Publishing build...');
|
console.log('Publishing build...');
|
||||||
|
|
||||||
return publishReleaseAsync({
|
return publishReleaseAsync({
|
||||||
token: GITHUB_TOKEN,
|
token: <string> GITHUB_TOKEN,
|
||||||
owner: 'resin-io',
|
owner: 'resin-io',
|
||||||
repo: 'resin-cli',
|
repo: 'resin-cli',
|
||||||
tag: version,
|
tag: version,
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rimraf build/ build-bin/",
|
"prebuild": "rimraf build/ build-bin/ build-zip/",
|
||||||
"build": "npm run build:src && npm run build:bin",
|
"build": "npm run build:src && npm run build:bin",
|
||||||
"build:src": "gulp build && tsc && npm run doc",
|
"build:src": "gulp build && tsc && npm run doc",
|
||||||
"build:bin": "ts-node --type-check -P automation automation/build-bin.ts",
|
"build:bin": "ts-node --type-check -P automation automation/build-bin.ts",
|
||||||
@ -55,6 +55,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/archiver": "^2.0.1",
|
"@types/archiver": "^2.0.1",
|
||||||
"@types/fs-extra": "^5.0.0",
|
"@types/fs-extra": "^5.0.0",
|
||||||
|
"@types/mkdirp": "^0.5.2",
|
||||||
"catch-uncommitted": "^1.0.0",
|
"catch-uncommitted": "^1.0.0",
|
||||||
"ent": "^2.2.0",
|
"ent": "^2.2.0",
|
||||||
"filehound": "^1.16.2",
|
"filehound": "^1.16.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user