From 3a600d0eea54f94df3361b59c06e2cf944e63cd1 Mon Sep 17 00:00:00 2001 From: Gary Katsevman Date: Fri, 14 Jul 2017 14:21:07 -0400 Subject: [PATCH] chore: add automatic github release (#4466) This will automatically do a github release with the correct changelog entry and the built zip file. If a publish is made with `--tag next` it will mark the release as a pre-release. To use, just add `VJS_GITHUB_USER` and `VJS_GITHUB_TOKEN` env variables as part of the publish command: ```sh $ VJS_GITHUB_USER=gkatsev VJS_GITHUB_TOKEN=test_token npm publish --tag next ``` --- build/current-changelog.js | 33 +++++++++++++++++++++++++++++++++ build/gh-release.js | 33 +++++++++++++++++++++++++++++++++ package.json | 5 +++++ 3 files changed, 71 insertions(+) create mode 100644 build/current-changelog.js create mode 100644 build/gh-release.js diff --git a/build/current-changelog.js b/build/current-changelog.js new file mode 100644 index 0000000000..3144b22091 --- /dev/null +++ b/build/current-changelog.js @@ -0,0 +1,33 @@ +var unified = require('unified'); +var markdown = require('remark-parse'); +var stringify = require('remark-stringify'); +var fs = require('fs'); + +module.exports = function() { + var processor = unified() + .use(markdown, {commonmark: true}) + .use(stringify); + + var ast = processor.parse(fs.readFileSync('./CHANGELOG.md')); + + var changelog = []; + changelog.push(processor.stringify(ast.children[0])); + + // start at 1 so we get the first anchor tag + // and can break on the second + for (var i = 1; i < ast.children.length; i++) { + var item = processor.stringify(ast.children[i]); + + if (/^