Included command to package and sign releases.
This commit is contained in:
parent
d5e389fbd3
commit
757c9d6524
|
@ -20,8 +20,11 @@ Ensure you've followed the instructions in the README.md for building the projec
|
||||||
To make a release, bump the version of the package.json:
|
To make a release, bump the version of the package.json:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
git checkout master
|
||||||
|
git pull upstream master
|
||||||
git commit -a -m "Bump package version to <version>"
|
git commit -a -m "Bump package version to <version>"
|
||||||
npm install
|
npm install
|
||||||
|
npm run package
|
||||||
npm run upload
|
npm run upload
|
||||||
npm publish
|
npm publish
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var packageRoot = __dirname + '/..';
|
function getTarballName() {
|
||||||
var version = require(packageRoot + '/package.json').version;
|
var packageRoot = __dirname + '/..';
|
||||||
var platform = process.platform;
|
var version = require(packageRoot + '/package.json').version;
|
||||||
var arch = process.arch;
|
var platform = process.platform;
|
||||||
var tarballName = 'libbitcoind-' + version + '-' + platform + '-' + arch + '.tgz';
|
var arch = process.arch;
|
||||||
|
var tarballName = 'libbitcoind-' + version + '-' + platform + '-' + arch + '.tgz';
|
||||||
|
return tarballName;
|
||||||
|
}
|
||||||
|
|
||||||
if (require.main === module) {
|
if (require.main === module) {
|
||||||
process.stdout.write(tarballName);
|
process.stdout.write(getTarballName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module.exports = getTarballName;
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var exec = require('child_process').exec;
|
||||||
|
var bindings = require('bindings');
|
||||||
|
var chainlib = require('chainlib');
|
||||||
|
var log = chainlib.log;
|
||||||
|
|
||||||
|
var packageRoot = bindings.getRoot(bindings.getFileName());
|
||||||
|
var binaryPath = bindings({
|
||||||
|
path: true,
|
||||||
|
bindings: 'bitcoind.node'
|
||||||
|
});
|
||||||
|
var relativeBinaryPath = binaryPath.replace(packageRoot + '/', '');
|
||||||
|
var tarballName = require('./get-tarball-name')();
|
||||||
|
|
||||||
|
log.info('Signing binding binary: "' + binaryPath + '"');
|
||||||
|
|
||||||
|
var signCommand = 'gpg --yes --out ' + binaryPath + '.sig --detach-sig ' + binaryPath;
|
||||||
|
|
||||||
|
var signchild = exec(signCommand, function(error, stdout, stderr) {
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stdout) {
|
||||||
|
log.info('GPG:', stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stderr) {
|
||||||
|
log.error(stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info('Packaging tarball: "' + tarballName + '"');
|
||||||
|
|
||||||
|
// Create a tarball of both the binding and the signature
|
||||||
|
var tarCommand = 'tar -C ' +
|
||||||
|
packageRoot + ' -cvzf ' +
|
||||||
|
tarballName + ' ' +
|
||||||
|
relativeBinaryPath + ' ' +
|
||||||
|
relativeBinaryPath + '.sig';
|
||||||
|
|
||||||
|
var tarchild = exec(tarCommand, function (error, stdout, stderr) {
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stdout) {
|
||||||
|
log.info('Tar:', stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stderr) {
|
||||||
|
log.error(stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
|
@ -1,9 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
|
var AWS = require('aws-sdk');
|
||||||
|
var bindings = require('bindings');
|
||||||
var chainlib = require('chainlib');
|
var chainlib = require('chainlib');
|
||||||
var log = chainlib.log;
|
var log = chainlib.log;
|
||||||
var AWS = require('aws-sdk');
|
|
||||||
|
|
||||||
var config = require(process.env.HOME + '/.bitcore-node-upload.json');
|
var config = require(process.env.HOME + '/.bitcore-node-upload.json');
|
||||||
|
|
||||||
|
@ -13,46 +14,23 @@ AWS.config.update({
|
||||||
secretAccessKey: config.secretAccessKey
|
secretAccessKey: config.secretAccessKey
|
||||||
});
|
});
|
||||||
|
|
||||||
var bindings = require('bindings');
|
|
||||||
var packageRoot = bindings.getRoot(bindings.getFileName());
|
var packageRoot = bindings.getRoot(bindings.getFileName());
|
||||||
var binaryPath = bindings({
|
var tarballName = require('./get-tarball-name')();
|
||||||
path: true,
|
|
||||||
bindings: 'bitcoind.node'
|
|
||||||
});
|
|
||||||
|
|
||||||
var relativeBinaryPath = binaryPath.replace(packageRoot + '/', '');
|
|
||||||
var exec = require('child_process').exec;
|
|
||||||
var version = require(packageRoot + '/package.json').version;
|
|
||||||
var platform = process.platform;
|
|
||||||
var arch = process.arch;
|
|
||||||
var tarballName = 'libbitcoind-' + version + '-' + platform + '-' + arch + '.tgz';
|
|
||||||
var bucketName = 'bitcore-node';
|
var bucketName = 'bitcore-node';
|
||||||
var url = 'https://' + bucketName + '.s3.amazonaws.com/' + tarballName;
|
var url = 'https://' + bucketName + '.s3.amazonaws.com/' + tarballName;
|
||||||
|
var localPath = packageRoot + '/' + tarballName;
|
||||||
|
|
||||||
var child = exec('tar -C ' + packageRoot + ' -cvzf ' + tarballName + ' ' + relativeBinaryPath,
|
log.info('Uploading package: ' + localPath);
|
||||||
function (error, stdout, stderr) {
|
|
||||||
|
|
||||||
if (error) {
|
var fileStream = fs.createReadStream(localPath);
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stdout) {
|
fileStream.on('error', function(err) {
|
||||||
log.info('Tar:', stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stderr) {
|
|
||||||
log.error(stderr);
|
|
||||||
}
|
|
||||||
|
|
||||||
var fileStream = fs.createReadStream(packageRoot + '/' + tarballName);
|
|
||||||
|
|
||||||
fileStream.on('error', function(err) {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
fileStream.on('open', function() {
|
fileStream.on('open', function() {
|
||||||
|
|
||||||
var s3 = new AWS.S3();
|
var s3 = new AWS.S3();
|
||||||
|
|
||||||
|
@ -71,7 +49,4 @@ var child = exec('tar -C ' + packageRoot + ' -cvzf ' + tarballName + ' ' + relat
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
"install": "./bin/install",
|
"install": "./bin/install",
|
||||||
"build": "./bin/build",
|
"build": "./bin/build",
|
||||||
"clean": "./bin/clean",
|
"clean": "./bin/clean",
|
||||||
|
"package": "node bin/package.js",
|
||||||
"upload": "node bin/upload.js",
|
"upload": "node bin/upload.js",
|
||||||
"start": "node bin/start.js",
|
"start": "node bin/start.js",
|
||||||
"test": "NODE_ENV=test mocha --recursive",
|
"test": "NODE_ENV=test mocha --recursive",
|
||||||
|
|
Loading…
Reference in New Issue