Skip to content

Commit

Permalink
feat: Build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
technote-space committed Aug 30, 2019
1 parent a1610b9 commit 2d91efa
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,17 @@
GitHub Action to generate TOC.
Just run [DocToc](https://github.com/thlorenz/doctoc) and commit to branch if changed.

<!-- START doctoc -->
<!-- END doctoc -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Screenshot](#screenshot)
- [Installation](#installation)
- [Action event details](#action-event-details)
- [Target event](#target-event)
- [Author](#author)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Screenshot

Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"tagName":"v0.0.3","branch":"gh-actions","tags":["v0.0.3","v0","v0.0"],"updated_at":"2019-08-30T15:42:13.270Z"}
{"tagName":"v0.0.4","branch":"gh-actions","tags":["v0.0.4","v0","v0.0"],"updated_at":"2019-08-30T17:01:27.649Z"}
7 changes: 6 additions & 1 deletion lib/utils/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ const commit = (workDir) => __awaiter(void 0, void 0, void 0, function* () {
yield execAsync(`git -C ${workDir} add --all`);
return true;
});
const getDiff = (workDir) => __awaiter(void 0, void 0, void 0, function* () { return (yield execAsync(`git -C ${workDir} status --short -uno`, false, null, false, true)).split(/\r\n|\n/).filter(line => line.match(/^M\s+/)).map(line => line.replace(/^M\s+/, '')); });
const getDiff = (workDir) => __awaiter(void 0, void 0, void 0, function* () {
return (yield execAsync(`git -C ${workDir} status --short -uno`, false, null, false, true))
.split(/\r\n|\n/)
.filter(line => line.match(/^M\s+/))
.map(line => line.replace(/^M\s+/, ''));
});
const execAsync = (command, quiet = false, altCommand = null, suppressError = false, suppressOutput = false) => new Promise((resolve, reject) => {
if ('string' === typeof altCommand)
signale_1.default.info('Run command: %s', altCommand);
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ exports.push = (files, octokit, context) => __awaiter(void 0, void 0, void 0, fu
signale_1.default.warn(`Branch [%s] is protected`, misc_1.getBranch(context));
return false;
}
signale_1.default.info('Start push to branch [%s]', misc_1.getBranch(context));
signale_1.default.info('>> Creating blobs...');
const blobs = yield filesToBlobs(files, octokit, context);
signale_1.default.info('>> Creating tree...');
Expand Down Expand Up @@ -87,7 +88,7 @@ const updateRef = (commit, octokit, context) => __awaiter(void 0, void 0, void 0
yield octokit.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.ref.replace(/^refs\//, ''),
ref: misc_1.getRefForUpdate(context),
sha: commit.data.sha,
});
});
Expand Down
1 change: 1 addition & 0 deletions lib/utils/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const getWorkspace = () => process.env.GITHUB_WORKSPACE || '';
exports.getWorkDir = () => path_1.default.resolve(getWorkspace(), '.work');
exports.getGitUrl = (context) => `https://github.com/${context.repo.owner}/${context.repo.repo}.git`;
exports.getRef = (context) => context.ref;
exports.getRefForUpdate = (context) => exports.getRef(context).replace(/^refs\//, '');
const isTargetRef = (context) => /^refs\/heads\//.test(exports.getRef(context));
exports.getBranch = (context) => exports.getRef(context).replace(/^refs\/heads\//, '');
exports.getCommitMessage = () => core_1.getInput('COMMIT_MESSAGE') || constant_1.DEFAULT_COMMIT_MESSAGE;

0 comments on commit 2d91efa

Please sign in to comment.