diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2017-11-16 04:14:20 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2017-11-16 04:14:20 +0800 |
commit | a9fbe921a04d2828bd17a60598a3eee0ec63445b (patch) | |
tree | 09ca7ed09d024cea91f203a614d83038e205206a /packages/0x.js/scripts | |
parent | 4e39a957c733d5593dc6d3fe81f96e43e4cc347a (diff) | |
download | dexon-sol-tools-a9fbe921a04d2828bd17a60598a3eee0ec63445b.tar dexon-sol-tools-a9fbe921a04d2828bd17a60598a3eee0ec63445b.tar.gz dexon-sol-tools-a9fbe921a04d2828bd17a60598a3eee0ec63445b.tar.bz2 dexon-sol-tools-a9fbe921a04d2828bd17a60598a3eee0ec63445b.tar.lz dexon-sol-tools-a9fbe921a04d2828bd17a60598a3eee0ec63445b.tar.xz dexon-sol-tools-a9fbe921a04d2828bd17a60598a3eee0ec63445b.tar.zst dexon-sol-tools-a9fbe921a04d2828bd17a60598a3eee0ec63445b.zip |
WIP
Diffstat (limited to 'packages/0x.js/scripts')
-rw-r--r-- | packages/0x.js/scripts/postpublish.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/packages/0x.js/scripts/postpublish.js b/packages/0x.js/scripts/postpublish.js new file mode 100644 index 000000000..c2dffa920 --- /dev/null +++ b/packages/0x.js/scripts/postpublish.js @@ -0,0 +1,32 @@ +const execAsync = require('async-child-process').execAsync; +const semverSort = require('semver-sort'); + +const packagePrefix = '0x.js@'; +const gitTagsCommand = 'git tags -l "' + packagePrefix + '*"'; +let latestTag; +execAsync(gitTagsCommand) + .then(function(result) { + if (result.stderr !== '') { + throw new Error(result.stderr); + } + const tags = result.stdout.trim().split('\n'); + const versions = tags.map(function(tag) { + return tag.slice(packagePrefix.length); + }); + const sortedVersions = semverSort.desc(versions); + latestTag = packagePrefix + sortedVersions[0]; + return execAsync('LATEST_TAG=' + latestTag + ' yarn release'); + }) + .then(function(result) { + if (result.stderr !== '') { + throw new Error(result.stderr); + } + return execAsync('yarn docs:json'); + }) + .then(function(result) { + if (result.stderr !== '') { + throw new Error(result.stderr); + } + const s3Url = 's3://0xjs-docs-jsons/v' + latestTag +'.json'; + return execAsync('S3_URL=' + s3Url + ' yarn upload_docs_json'); + }); |