Skip to content

Commit a146667

Browse files
feat: Build for release
1 parent 02ad3cd commit a146667

File tree

6 files changed

+15
-54
lines changed

6 files changed

+15
-54
lines changed

README.ja.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
- [CREATE_MAJOR_VERSION_TAG](#create_major_version_tag)
3333
- [CREATE_MINOR_VERSION_TAG](#create_minor_version_tag)
3434
- [CREATE_PATCH_VERSION_TAG](#create_patch_version_tag)
35-
- [OUTPUT_BUILD_INFO_FILENAME](#output_build_info_filename)
3635
- [FETCH_DEPTH](#fetch_depth)
3736
- [TEST_TAG_PREFIX](#test_tag_prefix)
3837
- [ORIGINAL_TAG_PREFIX](#original_tag_prefix)
@@ -144,24 +143,6 @@ default: `true`
144143
default: `true`
145144
[タグの詳細](#tags)
146145

147-
### OUTPUT_BUILD_INFO_FILENAME
148-
ビルド情報を出力するファイル名
149-
default: `''`
150-
絶対パスや `..` は使用できません。
151-
この設定が空でない場合、以下のような情報が出力されます。
152-
```json
153-
{
154-
"tagName": "${tagName}",
155-
"branch": "${branch}",
156-
"tags": [
157-
"${created_tag_1}",
158-
"...",
159-
"${created_tag_n}"
160-
],
161-
"updated_at": "${updated_at}"
162-
}
163-
```
164-
165146
### FETCH_DEPTH
166147
取得するコミット履歴の制限数
167148
default: `3`

README.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ Once you create a new tag, this action will automatically
3232
- [CREATE_MAJOR_VERSION_TAG](#create_major_version_tag)
3333
- [CREATE_MINOR_VERSION_TAG](#create_minor_version_tag)
3434
- [CREATE_PATCH_VERSION_TAG](#create_patch_version_tag)
35-
- [OUTPUT_BUILD_INFO_FILENAME](#output_build_info_filename)
3635
- [FETCH_DEPTH](#fetch_depth)
3736
- [TEST_TAG_PREFIX](#test_tag_prefix)
3837
- [ORIGINAL_TAG_PREFIX](#original_tag_prefix)
@@ -144,24 +143,6 @@ Whether to create patch version tag (e.g. v1.2.3).
144143
default: `true`
145144
[Detail of tags](#tags)
146145

147-
### OUTPUT_BUILD_INFO_FILENAME
148-
Filename of build information.
149-
default: `''`
150-
Absolute path and `..` are not permitted to use.
151-
If this setting is not empty, following information is output with the file name.
152-
```json
153-
{
154-
"tagName": "${tagName}",
155-
"branch": "${branch}",
156-
"tags": [
157-
"${created_tag_1}",
158-
"...",
159-
"${created_tag_n}"
160-
],
161-
"updated_at": "${updated_at}"
162-
}
163-
```
164-
165146
### FETCH_DEPTH
166147
Limit fetching to the specified number of commits from the tip of each remote branch history.
167148
default: `3`

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":"128dfd7128429534591d02bdd0edab6dc86b1f1a","ref":"refs/tags/test/v1.7.2.1","tagName":"test/v1.7.2.1","branch":"gh-actions","tags":["test/v1","test/v1.7","test/v1.7.2","test/v1.7.2.1"],"updated_at":"2019-12-07T18:59:15.473Z"}
1+
{"owner":"technote-space","repo":"release-github-actions","sha":"29703947003064a05fb77a9e81242aedd929edf0","ref":"refs/tags/test/v1.7.2.2","tagName":"test/v1.7.2.2","branch":"gh-actions","tags":["test/v1","test/v1.7","test/v1.7.2","test/v1.7.2.2"],"updated_at":"2019-12-08T04:16:17.836Z"}

lib/utils/command.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,11 @@ const command = new github_action_helper_1.Command(logger);
2828
const helper = new github_action_helper_1.GitHelper(logger, { depth: misc_1.getFetchDepth() });
2929
const { startProcess, info } = logger;
3030
exports.prepareFiles = (context) => __awaiter(void 0, void 0, void 0, function* () {
31-
startProcess('Preparing files for release');
3231
const { buildDir } = misc_1.getParams();
3332
fs_1.default.mkdirSync(buildDir, { recursive: true });
34-
startProcess('Cloning the working commit from the remote repo for build');
33+
startProcess('Cloning the remote repo for build...');
3534
yield helper.checkout(buildDir, context);
36-
startProcess('Running build for release');
35+
startProcess('Running build for release...');
3736
yield helper.runCommand(buildDir, misc_1.getBuildCommands(buildDir));
3837
});
3938
exports.createBuildInfoFile = (context) => __awaiter(void 0, void 0, void 0, function* () {
@@ -43,7 +42,7 @@ exports.createBuildInfoFile = (context) => __awaiter(void 0, void 0, void 0, fun
4342
}
4443
const { buildDir, branchName } = misc_1.getParams();
4544
const tagName = getTagName(context);
46-
startProcess('Creating build info file');
45+
startProcess('Creating build info file...');
4746
const filepath = path_1.default.resolve(buildDir, filename);
4847
const dir = path_1.default.dirname(filepath);
4948
if (!fs_1.default.existsSync(dir)) {
@@ -62,30 +61,30 @@ exports.createBuildInfoFile = (context) => __awaiter(void 0, void 0, void 0, fun
6261
});
6362
exports.cloneForBranch = (context) => __awaiter(void 0, void 0, void 0, function* () {
6463
const { pushDir, branchName } = misc_1.getParams();
65-
startProcess('Cloning the branch %s from the remote repo', branchName);
64+
startProcess('Cloning the branch [%s]...', branchName);
6665
yield helper.cloneBranch(pushDir, branchName, context);
6766
});
6867
exports.checkBranch = (clonedBranch) => __awaiter(void 0, void 0, void 0, function* () {
6968
const { pushDir, branchName } = misc_1.getParams();
7069
if (branchName !== clonedBranch) {
7170
info('remote branch %s not found.', branchName);
7271
info('now branch: %s', clonedBranch);
73-
startProcess('Initializing local git repo [%s]', branchName);
72+
startProcess('Initializing local git repo [%s]...', branchName);
7473
yield helper.gitInit(pushDir, branchName);
7574
}
7675
});
7776
exports.config = () => __awaiter(void 0, void 0, void 0, function* () {
7877
const { pushDir } = misc_1.getParams();
7978
const name = misc_1.getCommitName();
8079
const email = misc_1.getCommitEmail();
81-
startProcess('Configuring git committer to be %s <%s>', name, email);
80+
startProcess('Configuring git committer to be %s <%s>...', name, email);
8281
yield helper.config(pushDir, name, email);
8382
});
8483
exports.commit = () => __awaiter(void 0, void 0, void 0, function* () { return helper.commit(misc_1.getParams().pushDir, misc_1.getCommitMessage()); });
8584
exports.push = (context) => __awaiter(void 0, void 0, void 0, function* () {
8685
const { pushDir, branchName } = misc_1.getParams();
8786
const tagName = getTagName(context);
88-
startProcess('Pushing to %s@%s (tag: %s)', getRepository(context), branchName, tagName);
87+
startProcess('Pushing to %s@%s (tag: %s)...', getRepository(context), branchName, tagName);
8988
const prefix = misc_1.getOriginalTagPrefix();
9089
if (prefix) {
9190
const originalTag = prefix + tagName;
@@ -110,7 +109,7 @@ exports.updateRelease = (release, octokit, context) => __awaiter(void 0, void 0,
110109
if (!release || release.draft) {
111110
return;
112111
}
113-
startProcess('Re-publishing release');
112+
startProcess('Re-publishing release...');
114113
yield octokit.repos.updateRelease({
115114
owner: context.repo.owner,
116115
repo: context.repo.repo,
@@ -120,7 +119,7 @@ exports.updateRelease = (release, octokit, context) => __awaiter(void 0, void 0,
120119
});
121120
exports.copyFiles = () => __awaiter(void 0, void 0, void 0, function* () {
122121
const { buildDir, pushDir } = misc_1.getParams();
123-
startProcess('Copying %s contents to %s', buildDir, pushDir);
122+
startProcess('Copying %s contents to %s...', buildDir, pushDir);
124123
yield command.execAsync({
125124
command: 'rsync',
126125
args: ['-rl', '--exclude', '.git', '--delete', `${buildDir}/`, pushDir],
@@ -153,7 +152,7 @@ const executeCommit = (release, octokit, context) => __awaiter(void 0, void 0, v
153152
});
154153
exports.deploy = (octokit, context) => __awaiter(void 0, void 0, void 0, function* () {
155154
const { branchName } = misc_1.getParams();
156-
startProcess('Deploying branch %s to %s', branchName, getRepository(context));
155+
startProcess('Deploying branch %s to %s...', branchName, getRepository(context));
157156
const release = yield findRelease(octokit, context);
158157
yield exports.prepareCommit(context);
159158
yield executeCommit(release, octokit, context);

lib/utils/misc.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ exports.getBuildCommands = (dir) => {
4141
const pkgManager = useNpm(dir, core_1.getInput('PACKAGE_MANAGER')) ? 'npm' : 'yarn';
4242
const buildCommand = exports.detectBuildCommand(dir);
4343
const runSubCommand = pkgManager === 'npm' ? ' run ' : ' ';
44-
const hasInstallCommand = !!commands.filter(command => command.includes('npm run install') || command.includes(`${pkgManager} install`)).length;
44+
const hasInstallCommand = !!commands.filter(command => typeof command === 'string' && (command.includes('npm run install') || command.includes(`${pkgManager} install`))).length;
4545
if (typeof buildCommand === 'string') {
46-
commands = commands.filter(command => !command.startsWith(`npm run ${buildCommand}`) && !command.startsWith(`yarn ${buildCommand}`));
46+
commands = commands.filter(command => typeof command !== 'string' || !command.startsWith(`npm run ${buildCommand}`) && !command.startsWith(`yarn ${buildCommand}`));
4747
commands.push([pkgManager, runSubCommand, buildCommand].join(''));
4848
}
4949
if (!hasInstallCommand && commands.length) {
@@ -56,7 +56,7 @@ exports.getBuildCommands = (dir) => {
5656
commands.push(`${pkgManager} install --production`);
5757
}
5858
if (addRemove) {
59-
commands.push(...getCleanTargets().map(target => `rm -rdf ${target}`));
59+
commands.push({ command: 'rm', args: ['-rdf', ...getCleanTargets()] });
6060
}
6161
return commands;
6262
};

node_modules/.yarn-integrity

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

0 commit comments

Comments
 (0)