Skip to content

Commit 3d16385

Browse files
feat: Build for release
1 parent c6c42b5 commit 3d16385

40 files changed

+579
-218
lines changed

README.ja.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ default: `'gh-actions'`
122122
リリース前に削除するファイルやディレクトリ (カンマ区切り)
123123
default: `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml`
124124
絶対パスや `..` は使用できません。
125+
`BUILD_COMMAND`が指定されている場合、このパラメーターは無視されます。
125126

126127
### BUILD_COMMAND_TARGET
127128
ビルド用コマンド検索ターゲット

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ default: `'gh-actions'`
121121
### CLEAN_TARGETS
122122
Files or directories to delete before release (Comma separated).
123123
default: `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml`
124-
Absolute path and `..` are not permitted to use.
124+
Absolute path and `..` are not permitted to use.
125+
This parameter is ignored if `BUILD_COMMAND` is provided.
125126

126127
### BUILD_COMMAND_TARGET
127128
Command for search build command.

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":"5b1cb08c17d8043a09012a17704604397d22a022","ref":"refs/tags/v1.7.1","tagName":"v1.7.1","branch":"gh-actions","tags":["v1","v1.7","v1.7.1"],"updated_at":"2019-11-23T13:26:01.496Z"}
1+
{"owner":"technote-space","repo":"release-github-actions","sha":"8e8ef991272d8e47b5060921c82f74fa54cfc8f8","ref":"refs/tags/test/v1.7.2","tagName":"test/v1.7.2","branch":"gh-actions","tags":["test/v1","test/v1.7","test/v1.7.2"],"updated_at":"2019-12-07T18:55:06.489Z"}

lib/utils/command.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ 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 } = github_action_helper_1.Utils;
2122
exports.replaceDirectory = (message) => {
2223
const directories = misc_1.getReplaceDirectory();
23-
return Object.keys(directories).reduce((value, directory) => value.split(` -C ${directory}`).join('').split(directory).join(directories[directory]), message);
24+
return Object.keys(directories).reduce((value, directory) => replaceAll(replaceAll(value, ` -C ${directory}`, ''), directory, directories[directory]), message);
2425
};
2526
const logger = new github_action_helper_1.Logger(exports.replaceDirectory);
2627
const command = new github_action_helper_1.Command(logger);
@@ -120,11 +121,17 @@ exports.updateRelease = (release, octokit, context) => __awaiter(void 0, void 0,
120121
exports.copyFiles = () => __awaiter(void 0, void 0, void 0, function* () {
121122
const { buildDir, pushDir } = misc_1.getParams();
122123
startProcess('Copying %s contents to %s', buildDir, pushDir);
123-
yield command.execAsync({ command: `rsync -rl --exclude .git --delete "${buildDir}/" ${pushDir}` });
124+
yield command.execAsync({
125+
command: 'rsync',
126+
args: ['-rl', '--exclude', '.git', '--delete', `${buildDir}/`, pushDir],
127+
});
124128
});
125129
const initDirectory = () => __awaiter(void 0, void 0, void 0, function* () {
126130
const { workDir, pushDir } = misc_1.getParams();
127-
yield command.execAsync({ command: `rm -rdf ${workDir}` });
131+
yield command.execAsync({
132+
command: 'rm',
133+
args: ['-rdf', workDir],
134+
});
128135
fs_1.default.mkdirSync(pushDir, { recursive: true });
129136
});
130137
exports.prepareCommit = (context) => __awaiter(void 0, void 0, void 0, function* () {

lib/utils/misc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const path_1 = __importDefault(require("path"));
88
const github_action_helper_1 = require("@technote-space/github-action-helper");
99
const core_1 = require("@actions/core");
1010
const constant_1 = require("../constant");
11-
const { getWorkspace, escapeRegExp, getBoolValue, getArrayInput, uniqueArray, isSemanticVersioningTagName, useNpm } = github_action_helper_1.Utils;
11+
const { getWorkspace, getPrefixRegExp, getBoolValue, getArrayInput, uniqueArray, isSemanticVersioningTagName, useNpm } = github_action_helper_1.Utils;
1212
const getCleanTargets = () => uniqueArray((core_1.getInput('CLEAN_TARGETS') || constant_1.DEFAULT_CLEAN_TARGETS).split(',').map(target => target.trim()).filter(target => target && !target.startsWith('/') && !target.includes('..')));
1313
const normalizeCommand = (command) => command.trim().replace(/\s{2,}/g, ' ');
1414
exports.getSearchBuildCommandTargets = () => {
@@ -72,7 +72,7 @@ exports.getFetchDepth = () => {
7272
return constant_1.DEFAULT_FETCH_DEPTH;
7373
};
7474
exports.getTestTagPrefix = () => core_1.getInput('TEST_TAG_PREFIX') || constant_1.DEFAULT_TEST_TAG_PREFIX;
75-
const getTestTagPrefixRegExp = () => new RegExp('^' + escapeRegExp(exports.getTestTagPrefix()));
75+
const getTestTagPrefixRegExp = () => getPrefixRegExp(exports.getTestTagPrefix());
7676
exports.isTestTag = (tagName) => !!exports.getTestTagPrefix() && getTestTagPrefixRegExp().test(tagName);
7777
exports.getTestTag = (tagName) => tagName.replace(getTestTagPrefixRegExp(), '');
7878
exports.getOriginalTagPrefix = () => core_1.getInput('ORIGINAL_TAG_PREFIX') || constant_1.DEFAULT_ORIGINAL_TAG_PREFIX;

0 commit comments

Comments
 (0)