Skip to content

Commit ef20cc9

Browse files
feat: Build for release
1 parent e0cef86 commit ef20cc9

File tree

9 files changed

+44
-46
lines changed

9 files changed

+44
-46
lines changed

build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"owner":"technote-space","repo":"release-github-actions","sha":"42274db201a5cda34500c00cae33968fc9a1eef3","ref":"refs/tags/v3.0.1","tagName":"v3.0.1","branch":"gh-actions","tags":["v3.0.1","v3.0","v3"],"updated_at":"2020-02-11T11:38:50.703Z"}
1+
{"owner":"technote-space","repo":"release-github-actions","sha":"19e13186fad4af5d56de7ef9308d7d43a0985ce8","ref":"refs/tags/test/v3.0.2.39212018","tagName":"test/v3.0.2.39212018","branch":"gh-actions","tags":["test/v3.0.2.39212018","test/v3.0.2","test/v3.0","test/v3"],"updated_at":"2020-02-14T08:39:57.001Z"}

lib/main.js

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,16 @@ const filter_github_action_1 = require("@technote-space/filter-github-action");
1919
const github_action_helper_1 = require("@technote-space/github-action-helper");
2020
const command_1 = require("./utils/command");
2121
const constant_1 = require("./constant");
22-
/**
23-
* run
24-
*/
25-
function run() {
26-
return __awaiter(this, void 0, void 0, function* () {
27-
const logger = new github_action_helper_1.Logger();
28-
const context = new context_1.Context();
29-
github_action_helper_1.ContextHelper.showActionInfo(path_1.default.resolve(__dirname, '..'), logger, context);
30-
if (!filter_github_action_1.isTargetEvent(constant_1.TARGET_EVENTS, context)) {
31-
logger.info('This is not target event.');
32-
return;
33-
}
34-
yield command_1.deploy(github_action_helper_1.Utils.getOctokit(), context);
35-
});
36-
}
22+
const run = () => __awaiter(void 0, void 0, void 0, function* () {
23+
const logger = new github_action_helper_1.Logger();
24+
const context = new context_1.Context();
25+
github_action_helper_1.ContextHelper.showActionInfo(path_1.default.resolve(__dirname, '..'), logger, context);
26+
if (!filter_github_action_1.isTargetEvent(constant_1.TARGET_EVENTS, context)) {
27+
logger.info('This is not target event.');
28+
return;
29+
}
30+
yield command_1.deploy(github_action_helper_1.Utils.getOctokit(), context);
31+
});
3732
run().catch(error => {
3833
console.log(error);
3934
core_1.setFailed(error.message);

lib/utils/command.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const path_1 = __importDefault(require("path"));
1818
const github_action_helper_1 = require("@technote-space/github-action-helper");
1919
const misc_1 = require("./misc");
2020
const { getRepository, getTagName } = github_action_helper_1.ContextHelper;
21-
const { replaceAll, versionCompare, getPrefixRegExp } = github_action_helper_1.Utils;
21+
const { replaceAll, versionCompare, getPrefixRegExp, getRefspec } = github_action_helper_1.Utils;
2222
exports.replaceDirectory = (message) => {
2323
const directories = misc_1.getReplaceDirectory();
2424
return Object.keys(directories).reduce((value, directory) => replaceAll(replaceAll(value, ` -C ${directory}`, ''), directory, directories[directory]), message);
@@ -61,7 +61,7 @@ exports.createBuildInfoFile = (context) => __awaiter(void 0, void 0, void 0, fun
6161
exports.clone = (helper, context) => __awaiter(void 0, void 0, void 0, function* () {
6262
const { pushDir, branchName } = misc_1.getParams();
6363
startProcess('Fetching...');
64-
yield helper.fetchOrigin(pushDir, context, ['--no-tags'], [`refs/heads/${branchName}:refs/remotes/origin/${branchName}`]);
64+
yield helper.fetchOrigin(pushDir, context, ['--no-tags'], [getRefspec(branchName)]);
6565
startProcess('Switching branch to [%s]...', branchName);
6666
yield helper.switchBranch(pushDir, branchName);
6767
});

lib/utils/misc.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const { getWorkspace, getPrefixRegExp, getBoolValue, getArrayInput, uniqueArray,
1212
const getCleanTargets = () => getArrayInput('CLEAN_TARGETS')
1313
.map(target => target.replace(/[\x00-\x1f\x80-\x9f]/, '').trim()) // eslint-disable-line no-control-regex
1414
.filter(target => target && !target.startsWith('/') && !target.includes('..'));
15-
const normalizeCommand = (command) => command.trim().replace(/\s{2,}/g, ' ');
1615
exports.getSearchBuildCommandTargets = () => {
1716
const command = getArrayInput('BUILD_COMMAND_TARGET');
1817
if (command.length) {
@@ -32,7 +31,7 @@ exports.detectBuildCommand = (dir) => {
3231
const scripts = parsed['scripts'];
3332
for (const target of exports.getSearchBuildCommandTargets()) {
3433
if (target in scripts) {
35-
return normalizeCommand(target);
34+
return target;
3635
}
3736
}
3837
return false;
@@ -79,7 +78,7 @@ exports.getClearFilesCommands = (targets) => {
7978
return commands;
8079
};
8180
exports.getBuildCommands = (buildDir, pushDir) => {
82-
let commands = getArrayInput('BUILD_COMMAND', false, '&&').map(normalizeCommand);
81+
let commands = getArrayInput('BUILD_COMMAND', false, '&&');
8382
const pkgManager = useNpm(buildDir, core_1.getInput('PACKAGE_MANAGER')) ? 'npm' : 'yarn';
8483
const buildCommand = exports.detectBuildCommand(buildDir);
8584
const runSubCommand = pkgManager === 'npm' ? ' run ' : ' ';

node_modules/.yarn-integrity

Lines changed: 14 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@technote-space/filter-github-action/package.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@types/node/README.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@types/node/globals.d.ts

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@types/node/package.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)