Skip to content

Commit 5107d02

Browse files
feat: build for release
1 parent ccda26d commit 5107d02

File tree

7 files changed

+44
-63
lines changed

7 files changed

+44
-63
lines changed

README.ja.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,22 @@ jobs:
7474
## オプション
7575
| name | description | default | required | e.g. |
7676
|:---:|:---|:---:|:---:|:---:|
77-
|BUILD_COMMAND|ビルド用コマンド<br>[コマンドの詳細](#execute-commands)| | |`yarn build:all`|
78-
|CLEAN_TARGETS|リリース前に掃除するファイルやディレクトリ (カンマ区切り)<br>絶対パスや `..` は使用できません<br>[コマンドの詳細](#execute-commands)|`.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml`|true|`.[!.]*,*.txt`|
79-
|PACKAGE_MANAGER|依存関係のインストールに使用するパッケージマネージャー<br>`yarn.lock` や `package-lock.json` がある場合は自動で使用するパッケージマネージャーを決定しますが、このオプションで強制することができます<br>(`npm` または `yarn`)| | |`yarn`|
80-
|COMMIT_MESSAGE|コミット時に設定するメッセージ|`feat: build for release`|true|`feat: release`|
81-
|COMMIT_NAME|コミット時に設定する名前|`github-actions[bot]`|true| |
82-
|COMMIT_EMAIL|コミット時に設定する名前|`41898282+github-actions[bot]@users.noreply.github.com`|true| |
83-
|BRANCH_NAME|GitHub Actions 用のブランチ名|`gh-actions`|true| |
84-
|BUILD_COMMAND_TARGET|ビルド用コマンド検索ターゲット|`build, production, prod, package`| |`compile`|
85-
|CREATE_MAJOR_VERSION_TAG|メジャーバージョンタグ(例:v1)を作成するかどうか<br>[タグの詳細](#tags)|`true`| |`false`|
86-
|CREATE_MINOR_VERSION_TAG|マイナーバージョンタグ(例:v1.2)を作成するかどうか<br>[タグの詳細](#tags)|`true`| |`false`|
87-
|CREATE_PATCH_VERSION_TAG|パッチバージョンタグ(例:v1.2.3)を作成するかどうか<br>[タグの詳細](#tags)|`true`| |`false`|
88-
|FETCH_DEPTH|取得するコミット履歴の制限数|`3`| |`5`|
89-
|TEST_TAG_PREFIX|テスト用タグのプリフィックス| | |`test/`|
90-
|CLEAN_TEST_TAG|テストタグを掃除するかどうか|`false`| |`true`|
91-
|ORIGINAL_TAG_PREFIX|元のタグを残す際に付与するプリフィックス| | |`original/`|
92-
|GITHUB_TOKEN|アクセストークン|`${{github.token}}`|true|`${{secrets.ACCESS_TOKEN}}`|
77+
| BUILD_COMMAND | ビルド用コマンド<br>[コマンドの詳細](#execute-commands) | | | `yarn build:all` |
78+
| CLEAN_TARGETS | リリース前に掃除するファイルやディレクトリ (カンマ区切り)<br>絶対パスや `..` は使用できません<br>[コマンドの詳細](#execute-commands) |`.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml` | true | `.[!.]*,*.txt` |
79+
| PACKAGE_MANAGER | 依存関係のインストールに使用するパッケージマネージャー<br>`yarn.lock` や `package-lock.json` がある場合は自動で使用するパッケージマネージャーを決定しますが、このオプションで強制することができます<br>(`npm` または `yarn`) | | | `yarn` |
80+
| COMMIT_MESSAGE | コミット時に設定するメッセージ | `feat: build for release` | true | `feat: release` |
81+
| COMMIT_NAME | コミット時に設定する名前 | `github-actions[bot]` | true | |
82+
| COMMIT_EMAIL | コミット時に設定する名前 | `41898282+github-actions[bot]@users.noreply.github.com` | true | |
83+
| BRANCH_NAME | GitHub Actions 用のブランチ名 | `gh-actions` | true | |
84+
| BUILD_COMMAND_TARGET | ビルド用コマンド検索ターゲット | `build, production, prod, package` | | `compile` |
85+
| CREATE_MAJOR_VERSION_TAG | メジャーバージョンタグ(例:v1)を作成するかどうか<br>[タグの詳細](#tags) | `true` | | `false` |
86+
| CREATE_MINOR_VERSION_TAG | マイナーバージョンタグ(例:v1.2)を作成するかどうか<br>[タグの詳細](#tags) | `true` | | `false` |
87+
| CREATE_PATCH_VERSION_TAG | パッチバージョンタグ(例:v1.2.3)を作成するかどうか<br>[タグの詳細](#tags) | `true` | | `false` |
88+
| FETCH_DEPTH | 取得するコミット履歴の制限数 | `3` | | `5` |
89+
| TEST_TAG_PREFIX | テスト用タグのプリフィックス | | | `test/` |
90+
| CLEAN_TEST_TAG | テストタグを掃除するかどうか | `false` | | `true` |
91+
| ORIGINAL_TAG_PREFIX | 元のタグを残す際に付与するプリフィックス | | | `original/` |
92+
| GITHUB_TOKEN | アクセストークン | `${{github.token}}` | true | `${{secrets.ACCESS_TOKEN}}` |
9393

9494
## CLI ツール
9595
[![technote-space/release-github-actions-cli - GitHub](https://gh-card.dev/repos/technote-space/release-github-actions-cli.svg)](https://github.com/technote-space/release-github-actions-cli)

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,22 @@ jobs:
7474
## Options
7575
| name | description | default | required | e.g. |
7676
|:---:|:---|:---:|:---:|:---:|
77-
|BUILD_COMMAND|Build command<br>[More details of execute command](#execute-commands)| | |`yarn build:all`|
78-
|CLEAN_TARGETS|Files or directories to clean before release (Comma separated)<br>Absolute path and `..` are not permitted to use.<br>[More details of execute command](#execute-commands)|`.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml`|true|`.[!.]*,*.txt`|
79-
|PACKAGE_MANAGER|Package manager to use to install dependencies<br>If there is `yarn.lock` or` package-lock.json`, the action automatically determines the package manager to use, but this option can be used to specify it explicitly.<br>(`npm` or `yarn`)| | |`yarn`|
80-
|COMMIT_MESSAGE|Commit message|`feat: build for release`|true|`feat: release`|
81-
|COMMIT_NAME|Commit name|`github-actions[bot]`|true| |
82-
|COMMIT_EMAIL|Commit email|`41898282+github-actions[bot]@users.noreply.github.com`|true| |
83-
|BRANCH_NAME|Branch name for `GitHub Actions` release|`gh-actions`|true| |
84-
|BUILD_COMMAND_TARGET|Command for search build command|`build, production, prod, package`| |`compile`|
85-
|CREATE_MAJOR_VERSION_TAG|Whether to create major version tag (e.g. v1)<br>[Detail of tags](#tags)|`true`| |`false`|
86-
|CREATE_MINOR_VERSION_TAG|Whether to create minor version tag (e.g. v1.2)<br>[Detail of tags](#tags)|`true`| |`false`|
87-
|CREATE_PATCH_VERSION_TAG|Whether to create patch version tag (e.g. v1.2.3)<br>[Detail of tags](#tags)|`true`| |`false`|
88-
|FETCH_DEPTH|Limit fetching to the specified number of commits from the tip of each remote branch history|`3`| |`5`|
89-
|TEST_TAG_PREFIX|Prefix for test tag| | |`test/`|
90-
|CLEAN_TEST_TAG|Whether to clean test tag|`false`| |`true`|
91-
|ORIGINAL_TAG_PREFIX|Prefix to add when leaving the original tag| | |`original/`|
92-
|GITHUB_TOKEN|Access token|`${{github.token}}`|true|`${{secrets.ACCESS_TOKEN}}`|
77+
| BUILD_COMMAND | Build command<br>[More details of execute command](#execute-commands) | | | `yarn build:all` |
78+
| CLEAN_TARGETS | Files or directories to clean before release (Comma separated)<br>Absolute path and `..` are not permitted to use.<br>[More details of execute command](#execute-commands) | `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,*.yml,*.yaml` | true | `.[!.]*,*.txt` |
79+
| PACKAGE_MANAGER | Package manager to use to install dependencies<br>If there is `yarn.lock` or` package-lock.json`, the action automatically determines the package manager to use, but this option can be used to specify it explicitly.<br>(`npm` or `yarn`) | | | `yarn` |
80+
| COMMIT_MESSAGE | Commit message | `feat: build for release` | true | `feat: release` |
81+
| COMMIT_NAME | Commit name | `github-actions[bot]` | true | |
82+
| COMMIT_EMAIL | Commit email | `41898282+github-actions[bot]@users.noreply.github.com` | true | |
83+
| BRANCH_NAME | Branch name for `GitHub Actions` release | `gh-actions` | true | |
84+
| BUILD_COMMAND_TARGET | Command for search build command | `build, production, prod, package` | | `compile` |
85+
| CREATE_MAJOR_VERSION_TAG | Whether to create major version tag (e.g. v1)<br>[Detail of tags](#tags) | `true` | | `false` |
86+
| CREATE_MINOR_VERSION_TAG | Whether to create minor version tag (e.g. v1.2)<br>[Detail of tags](#tags) | `true` | | `false` |
87+
| CREATE_PATCH_VERSION_TAG | Whether to create patch version tag (e.g. v1.2.3)<br>[Detail of tags](#tags) | `true` | | `false` |
88+
| FETCH_DEPTH | Limit fetching to the specified number of commits from the tip of each remote branch history | `3` | | `5` |
89+
| TEST_TAG_PREFIX | Prefix for test tag | | | `test/` |
90+
| CLEAN_TEST_TAG | Whether to clean test tag | `false` | | `true` |
91+
| ORIGINAL_TAG_PREFIX | Prefix to add when leaving the original tag | | | `original/` |
92+
| GITHUB_TOKEN | Access token | `${{github.token}}` | true | `${{secrets.ACCESS_TOKEN}}` |
9393

9494
## CLI Tool
9595
[![technote-space/release-github-actions-cli - GitHub](https://gh-card.dev/repos/technote-space/release-github-actions-cli.svg)](https://github.com/technote-space/release-github-actions-cli)

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ inputs:
3939
required: true
4040
BUILD_COMMAND_TARGET:
4141
description: Command for search build command.
42-
default: ''
43-
required: false
42+
default: 'build,production,prod,package'
43+
required: true
4444
CREATE_MAJOR_VERSION_TAG:
4545
description: Whether to create major version tag.
4646
default: 'true'

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":"d62a0bc1d7ffc51917a3ac66a1e4f24751f81c85","ref":"refs/tags/v3.1.2","tagName":"v3.1.2","branch":"gh-actions","tags":["v3.1.2","v3.1","v3"],"updated_at":"2020-03-05T14:00:51.173Z"}
1+
{"owner":"technote-space","repo":"release-github-actions","sha":"68fd98cc6246de3c595520ac51ea519cf450fc08","ref":"refs/tags/test/v3.1.3.50201616","tagName":"test/v3.1.3.50201616","branch":"gh-actions","tags":["test/v3.1.3.50201616","test/v3.1.3","test/v3.1","test/v3"],"updated_at":"2020-03-05T15:50:12.646Z"}

lib/constant.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,7 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
33
const misc_1 = require("./utils/misc");
4-
exports.DEFAULT_COMMIT_MESSAGE = 'feat: build for release';
5-
exports.DEFAULT_COMMIT_NAME = 'github-actions[bot]';
6-
exports.DEFAULT_COMMIT_EMAIL = '41898282+github-actions[bot]@users.noreply.github.com';
7-
exports.DEFAULT_BRANCH_NAME = 'gh-actions';
8-
exports.DEFAULT_OUTPUT_BUILD_INFO_FILENAME = '';
94
exports.DEFAULT_FETCH_DEPTH = 3;
10-
exports.DEFAULT_TEST_TAG_PREFIX = '';
11-
exports.DEFAULT_ORIGINAL_TAG_PREFIX = '';
12-
exports.DEFAULT_SEARCH_BUILD_COMMAND_TARGETS = [
13-
'build',
14-
'production',
15-
'prod',
16-
'package',
17-
];
185
exports.TARGET_EVENTS = {
196
'create': [
207
(context) => misc_1.isValidContext(context),

lib/utils/misc.js

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,7 @@ 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-
exports.getSearchBuildCommandTargets = () => {
16-
const command = getArrayInput('BUILD_COMMAND_TARGET');
17-
if (command.length) {
18-
return command;
19-
}
20-
return constant_1.DEFAULT_SEARCH_BUILD_COMMAND_TARGETS;
21-
};
15+
exports.getSearchBuildCommandTargets = () => getArrayInput('BUILD_COMMAND_TARGET', true);
2216
exports.detectBuildCommand = (dir) => {
2317
const packageFile = path_1.default.resolve(dir, 'package.json');
2418
if (!fs_1.default.existsSync(packageFile)) {
@@ -101,28 +95,28 @@ exports.getBuildCommands = (buildDir, pushDir) => {
10195
commands.push(...exports.getRestoreBackupCommands(buildDir, pushDir));
10296
return commands;
10397
};
104-
exports.getCommitMessage = () => core_1.getInput('COMMIT_MESSAGE') || constant_1.DEFAULT_COMMIT_MESSAGE;
105-
exports.getCommitName = () => core_1.getInput('COMMIT_NAME') || constant_1.DEFAULT_COMMIT_NAME;
106-
exports.getCommitEmail = () => core_1.getInput('COMMIT_EMAIL') || constant_1.DEFAULT_COMMIT_EMAIL;
107-
exports.getBranchName = () => core_1.getInput('BRANCH_NAME') || constant_1.DEFAULT_BRANCH_NAME;
98+
exports.getCommitMessage = () => core_1.getInput('COMMIT_MESSAGE', { required: true });
99+
exports.getCommitName = () => core_1.getInput('COMMIT_NAME', { required: true });
100+
exports.getCommitEmail = () => core_1.getInput('COMMIT_EMAIL', { required: true });
101+
exports.getBranchName = () => core_1.getInput('BRANCH_NAME', { required: true });
108102
exports.getFetchDepth = () => {
109103
const depth = core_1.getInput('FETCH_DEPTH');
110104
if (depth && /^\d+$/.test(depth)) {
111105
return parseInt(depth, 10);
112106
}
113107
return constant_1.DEFAULT_FETCH_DEPTH;
114108
};
115-
exports.getTestTagPrefix = () => core_1.getInput('TEST_TAG_PREFIX') || constant_1.DEFAULT_TEST_TAG_PREFIX;
109+
exports.getTestTagPrefix = () => core_1.getInput('TEST_TAG_PREFIX');
116110
const getTestTagPrefixRegExp = () => getPrefixRegExp(exports.getTestTagPrefix());
117111
exports.isTestTag = (tagName) => !!exports.getTestTagPrefix() && getTestTagPrefixRegExp().test(tagName);
118112
exports.getTestTag = (tagName) => tagName.replace(getTestTagPrefixRegExp(), '');
119-
exports.getOriginalTagPrefix = () => core_1.getInput('ORIGINAL_TAG_PREFIX') || constant_1.DEFAULT_ORIGINAL_TAG_PREFIX;
113+
exports.getOriginalTagPrefix = () => core_1.getInput('ORIGINAL_TAG_PREFIX');
120114
exports.isCreateMajorVersionTag = () => getBoolValue(core_1.getInput('CREATE_MAJOR_VERSION_TAG') || 'true');
121115
exports.isCreateMinorVersionTag = () => getBoolValue(core_1.getInput('CREATE_MINOR_VERSION_TAG') || 'true');
122116
exports.isCreatePatchVersionTag = () => getBoolValue(core_1.getInput('CREATE_PATCH_VERSION_TAG') || 'true');
123117
exports.isEnabledCleanTestTag = () => getBoolValue(core_1.getInput('CLEAN_TEST_TAG'));
124118
exports.getOutputBuildInfoFilename = () => {
125-
const filename = (core_1.getInput('OUTPUT_BUILD_INFO_FILENAME') || constant_1.DEFAULT_OUTPUT_BUILD_INFO_FILENAME).trim();
119+
const filename = core_1.getInput('OUTPUT_BUILD_INFO_FILENAME');
126120
if (filename.startsWith('/') || filename.includes('..')) {
127121
return '';
128122
}

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)