Skip to content

Commit aba8c5f

Browse files
author
GitHub Actions
committed
feat: Build for release
1 parent ab0e2e3 commit aba8c5f

File tree

12 files changed

+200
-110
lines changed

12 files changed

+200
-110
lines changed

README.ja.md

Lines changed: 64 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,24 @@
2121
- [スクリーンショット](#%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88)
2222
- [インストール](#%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB)
2323
- [オプション](#%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3)
24-
- [PACKAGE_MANAGER](#package_manager)
2524
- [BUILD_COMMAND](#build_command)
25+
- [DELETE_TARGETS](#delete_targets)
26+
- [PACKAGE_MANAGER](#package_manager)
2627
- [COMMIT_MESSAGE](#commit_message)
2728
- [COMMIT_NAME](#commit_name)
2829
- [COMMIT_EMAIL](#commit_email)
2930
- [BRANCH_NAME](#branch_name)
30-
- [CLEAN_TARGETS](#clean_targets)
3131
- [BUILD_COMMAND_TARGET](#build_command_target)
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)
3535
- [FETCH_DEPTH](#fetch_depth)
3636
- [TEST_TAG_PREFIX](#test_tag_prefix)
37+
- [CLEAN_TEST_TAG](#clean_test_tag)
3738
- [ORIGINAL_TAG_PREFIX](#original_tag_prefix)
39+
- [Execute commands](#execute-commands)
40+
- [ビルド](#%E3%83%93%E3%83%AB%E3%83%89)
41+
- [ファイル削除](#%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%89%8A%E9%99%A4)
3842
- [Action イベント詳細](#action-%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E8%A9%B3%E7%B4%B0)
3943
- [対象イベント](#%E5%AF%BE%E8%B1%A1%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88)
4044
- [condition](#condition)
@@ -77,56 +81,45 @@
7781
[対象イベントの詳細](#action-%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E8%A9%B3%E7%B4%B0)
7882
7983
## オプション
84+
### BUILD_COMMAND
85+
ビルド用コマンド
86+
default: `''`
87+
[More details of execute command](#execute-commands)
88+
89+
### DELETE_TARGETS
90+
[More details of execute command](#execute-commands)
91+
リリース前に削除するファイルやディレクトリ (カンマ区切り)
92+
default: `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml`
93+
絶対パスや `..` は使用できません。
94+
8095
### PACKAGE_MANAGER
8196
依存関係のインストールに使用するパッケージマネージャー
8297
`yarn.lock` や `package-lock.json` がある場合は自動で使用するパッケージマネージャーを決定しますが、このオプションで強制することができます。
8398
(`npm` または `yarn`)
8499
default: `''`
85100
例:`npm`
86101

87-
### BUILD_COMMAND
88-
ビルド用コマンド
89-
default: `''`
90-
- `build`、 `production` または `prod` が package.json の scripts に含まれる場合、ビルド用のコマンドとしてそれを使用します。([BUILD_COMMAND_TARGET](#build_command_target) で変更可能です)
91-
- `npm run install` や `yarn install` のようなインストール用コマンドが存在しない場合、インストール用コマンドが追加されます。
92-
- ビルド用コマンドが空の場合、いくつかのファイルが削除されます。 (詳細:[CLEAN_TARGETS](#clean_targets)).
93-
94-
したがって、`BUILD_COMMAND` が設定されていない かつ package.json に `build` が存在する場合、以下のコマンドが実行されます。
95-
```shell
96-
yarn install
97-
yarn build
98-
yarn install --production
99-
rm -rdf .[!.]*
100-
...
101-
rm -rdf _config.yml
102-
```
103-
104102
### COMMIT_MESSAGE
105103
コミット時に設定するメッセージ
106104
default: `'feat: Build for release'`
107105

108106
### COMMIT_NAME
109107
コミット時に設定する名前
110-
default: `'GitHub Actions'`
108+
default: `'github-actions[bot]'`
111109

112110
### COMMIT_EMAIL
113111
コミット時に設定するメールアドレス
114-
default: `'example@example.com'`
112+
default: `'41898282+github-actions[bot]@users.noreply.github.com'`
115113

116114
### BRANCH_NAME
117115
GitHub Actions 用のブランチ名
118116
default: `'gh-actions'`
119117

120-
### CLEAN_TARGETS
121-
リリース前に削除するファイルやディレクトリ (カンマ区切り)
122-
default: `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml`
123-
絶対パスや `..` は使用できません。
124-
`BUILD_COMMAND`が指定されている場合、このパラメーターは無視されます。
125-
126118
### BUILD_COMMAND_TARGET
127119
ビルド用コマンド検索ターゲット
128120
default: `''`
129-
例:`compile`
121+
例:`compile`
122+
このオプションが設定されていない場合、`build`, `production`, `prod` と `package` が使用されます。
130123

131124
### CREATE_MAJOR_VERSION_TAG
132125
メジャーバージョンタグ(例:v1)を作成するかどうか
@@ -150,12 +143,53 @@ default: `3`
150143
### TEST_TAG_PREFIX
151144
テスト用タグのプリフィックス
152145
default: `''`
153-
例:`'test/'`
146+
例:`'test/'`
147+
148+
### CLEAN_TEST_TAG
149+
テストタグを掃除するかどうか
150+
default: `'false'`
151+
例:`'true'`
154152

155153
### ORIGINAL_TAG_PREFIX
156154
元のタグを残す際に付与するプリフィックス
157155
default: `''`
158-
例:`'original/'`
156+
例:`'original/'`
157+
158+
## Execute commands
159+
### ビルド
160+
- `build`、 `production` または `prod` が package.json の scripts に含まれる場合、ビルド用のコマンドとしてそれを使用します。([BUILD_COMMAND_TARGET](#build_command_target) で変更可能です)
161+
- `npm run install` や `yarn install` のようなインストール用コマンドが存在しない場合、インストール用コマンドが追加されます。
162+
163+
したがって、`BUILD_COMMAND` が設定されていない かつ package.json に `build` が存在する場合、以下のコマンドが実行されます。
164+
165+
```shell
166+
yarn install
167+
yarn build
168+
yarn install --production
169+
```
170+
171+
### ファイル削除
172+
`GitHub Actions` の実行には「ビルドに使用するソース」や「テストファイル」、「テストの設定」などを必要としません。
173+
そして `GitHub Actions` は使用されるたびにダウンロードされるため、ファイルは少ないほうが良いです。
174+
175+
`DELETE_TARGETS` オプションはこの目的のために使用されます。
176+
default: `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml`
177+
178+
```shell
179+
rm -rdf .[!.]*
180+
rm -rdf *.js
181+
rm -rdf *.ts
182+
rm -rdf *.json
183+
rm -rdf *.lock
184+
rm -rdf __tests__ src '_config.yml'
185+
```
186+
187+
このデフォルト値は「TypeScriptのActionテンプレート」や「JavaScriptのActionテンプレート」の使用を想定した値になっています。
188+
https://github.com/actions/typescript-action
189+
https://github.com/actions/javascript-action
190+
191+
不要なファイルが削除された`GitHub Actions`の例を以下で確認できます。
192+
https://github.com/technote-space/release-github-actions/tree/gh-actions
159193

160194
## Action イベント詳細
161195
### 対象イベント

README.md

Lines changed: 65 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,24 @@ Once you create a new tag, this action will automatically
2121
- [Screenshots](#screenshots)
2222
- [Installation](#installation)
2323
- [Options](#options)
24-
- [PACKAGE_MANAGER](#package_manager)
2524
- [BUILD_COMMAND](#build_command)
25+
- [DELETE_TARGETS](#delete_targets)
26+
- [PACKAGE_MANAGER](#package_manager)
2627
- [COMMIT_MESSAGE](#commit_message)
2728
- [COMMIT_NAME](#commit_name)
2829
- [COMMIT_EMAIL](#commit_email)
2930
- [BRANCH_NAME](#branch_name)
30-
- [CLEAN_TARGETS](#clean_targets)
3131
- [BUILD_COMMAND_TARGET](#build_command_target)
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)
3535
- [FETCH_DEPTH](#fetch_depth)
3636
- [TEST_TAG_PREFIX](#test_tag_prefix)
37+
- [CLEAN_TEST_TAG](#clean_test_tag)
3738
- [ORIGINAL_TAG_PREFIX](#original_tag_prefix)
39+
- [Execute commands](#execute-commands)
40+
- [Build](#build)
41+
- [Delete files](#delete-files)
3842
- [Action event details](#action-event-details)
3943
- [Target events](#target-events)
4044
- [condition](#condition)
@@ -77,56 +81,44 @@ Once you create a new tag, this action will automatically
7781
[More details of target event](#action-event-details)
7882
7983
## Options
84+
### BUILD_COMMAND
85+
Build command.
86+
default: `''`
87+
[More details of execute command](#execute-commands)
88+
89+
### DELETE_TARGETS
90+
Files or directories to delete before release (Comma separated).
91+
default: `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml`
92+
Absolute path and `..` are not permitted to use.
93+
[More details of execute command](#execute-commands)
94+
8095
### PACKAGE_MANAGER
8196
Package manager to use to install dependencies.
8297
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.
8398
(`npm` or `yarn`)
8499
default: `''`
85100

86-
### BUILD_COMMAND
87-
Build command.
88-
default: `''`
89-
- If package.json includes `build` or `production` or `prod` in scripts, the command is used for build. (You can change this with [BUILD_COMMAND_TARGET](#build_command_target))
90-
- If command does not have install command like `npm run install` or `yarn install`, install commands are added.
91-
- If command is not provided, some files are deleted (see [CLEAN_TARGETS](#clean_targets)).
92-
93-
so if `BUILD_COMMAND` is not provided and package.json has `build` script,
94-
the following commands are executed.
95-
```shell
96-
yarn install
97-
yarn build
98-
yarn install --production
99-
rm -rdf .[!.]*
100-
...
101-
rm -rdf _config.yml
102-
```
103-
104101
### COMMIT_MESSAGE
105102
Commit message.
106103
default: `'feat: Build for release'`
107104

108105
### COMMIT_NAME
109106
Commit name.
110-
default: `'GitHub Actions'`
107+
default: `'github-actions[bot]'`
111108

112109
### COMMIT_EMAIL
113110
Commit email.
114-
default: `'example@example.com'`
111+
default: `'41898282+github-actions[bot]@users.noreply.github.com'`
115112

116113
### BRANCH_NAME
117114
Branch name for `GitHub Actions` release.
118115
default: `'gh-actions'`
119116

120-
### CLEAN_TARGETS
121-
Files or directories to delete before release (Comma separated).
122-
default: `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml`
123-
Absolute path and `..` are not permitted to use.
124-
This parameter is ignored if `BUILD_COMMAND` is provided.
125-
126117
### BUILD_COMMAND_TARGET
127118
Command for search build command.
128119
default: `''`
129-
e.g. `compile`
120+
e.g. `compile`
121+
If this option is not provided, `build`, `production`, `prod` and `package` are used.
130122

131123
### CREATE_MAJOR_VERSION_TAG
132124
Whether to create major version tag (e.g. v1).
@@ -150,12 +142,54 @@ default: `3`
150142
### TEST_TAG_PREFIX
151143
Prefix for test tag.
152144
default: `''`
153-
e.g. `'test/'`
145+
e.g. `'test/'`
146+
147+
### CLEAN_TEST_TAG
148+
Whether to clean test tag.
149+
default: `'false'`
150+
e.g. `'true'`
154151

155152
### ORIGINAL_TAG_PREFIX
156153
Prefix to add when leaving the original tag.
157154
default: `''`
158-
e.g. `'original/'`
155+
e.g. `'original/'`
156+
157+
## Execute commands
158+
### Build
159+
- If package.json includes `build`, `production`, `prod` or `package` in scripts, the command is used for build. (You can change this with [BUILD_COMMAND_TARGET](#build_command_target))
160+
- If command does not have install command like `npm run install` or `yarn install`, install commands are added.
161+
162+
so if `BUILD_COMMAND` is not provided and package.json has `build` script,
163+
the following commands are executed for build.
164+
165+
```shell
166+
yarn install
167+
yarn build
168+
yarn install --production
169+
```
170+
171+
### Delete files
172+
To execute `GitHub Actions`, `src files used for build`, `test files`, `test settings`, etc. are not required.
173+
And `GitHub Actions` is downloaded every time when it is used, so fewer files are better.
174+
175+
`DELETE_TARGETS` option is used for this purpose.
176+
default: `.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml`
177+
178+
```shell
179+
rm -rdf .[!.]*
180+
rm -rdf *.js
181+
rm -rdf *.ts
182+
rm -rdf *.json
183+
rm -rdf *.lock
184+
rm -rdf __tests__ src '_config.yml'
185+
```
186+
187+
The default setting assumes the use of `Action template for TypeScript` or `Action template for JavaScript`.
188+
https://github.com/actions/typescript-action
189+
https://github.com/actions/javascript-action
190+
191+
You can see an example of `GitHub Actions` with unnecessary files deleted below.
192+
https://github.com/technote-space/release-github-actions/tree/gh-actions
159193

160194
## Action event details
161195
### Target events

action.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Release GitHub Actions
2-
description: This is a GitHub Action that automates the release of GitHub Action.
2+
3+
description: This is a GitHub Actions that automates the release of GitHub Actions.
4+
35
author: technote-space
6+
47
inputs:
58
GITHUB_TOKEN:
69
description: Secret GitHub API token to use for making API requests.
@@ -16,14 +19,14 @@ inputs:
1619
default: 'feat: Build for release'
1720
COMMIT_NAME:
1821
description: Git commit name.
19-
default: 'GitHub Actions'
22+
default: 'github-actions[bot]'
2023
COMMIT_EMAIL:
2124
description: Git commit email.
22-
default: 'example@example.com'
25+
default: '41898282+github-actions[bot]@users.noreply.github.com'
2326
BRANCH_NAME:
2427
description: Branch name.
2528
default: 'gh-actions'
26-
CLEAN_TARGETS:
29+
DELETE_TARGETS:
2730
description: Files or directories to delete before release. (Comma separated)
2831
default: '.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml'
2932
BUILD_COMMAND_TARGET:
@@ -45,14 +48,19 @@ inputs:
4548
description: Limit fetching to the specified number of commits from the tip of each remote branch history.
4649
default: '3'
4750
TEST_TAG_PREFIX:
48-
description: Tag name prefix for test
51+
description: Tag name prefix for test.
4952
default: ''
53+
CLEAN_TEST_TAG:
54+
description: Whether to clean test tag.
55+
default: false
5056
ORIGINAL_TAG_PREFIX:
51-
description: Tag name prefix for original tag
57+
description: Tag name prefix for original tag.
5258
default: ''
59+
5360
branding:
5461
icon: 'tag'
5562
color: 'green'
63+
5664
runs:
5765
using: node12
5866
main: lib/main.js

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":"cb0e475bc22e1aca897239ffeae4001309c25050","ref":"refs/tags/v1.7.3","tagName":"v1.7.3","branch":"gh-actions","tags":["v1","v1.7","v1.7.3"],"updated_at":"2019-12-08T12:29:36.279Z"}
1+
{"owner":"technote-space","repo":"release-github-actions","sha":"6d981505947fa0a939a019876c320e3dfe1f5a20","ref":"refs/tags/test/v2.0.0","tagName":"test/v2.0.0","branch":"gh-actions","tags":["test/v2","test/v2.0","test/v2.0.0"],"updated_at":"2019-12-08T18:09:05.788Z"}

lib/constant.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
Object.defineProperty(exports, "__esModule", { value: true });
33
const misc_1 = require("./utils/misc");
44
exports.DEFAULT_COMMIT_MESSAGE = 'feat: Build for release';
5-
exports.DEFAULT_COMMIT_NAME = 'GitHub Actions';
6-
exports.DEFAULT_COMMIT_EMAIL = 'example@example.com';
5+
exports.DEFAULT_COMMIT_NAME = 'github-actions[bot]';
6+
exports.DEFAULT_COMMIT_EMAIL = '41898282+github-actions[bot]@users.noreply.github.com';
77
exports.DEFAULT_BRANCH_NAME = 'gh-actions';
8-
exports.DEFAULT_CLEAN_TARGETS = '.[!.]*,__tests__,src,*.js,*.ts,*.json,*.lock,_config.yml';
98
exports.DEFAULT_OUTPUT_BUILD_INFO_FILENAME = '';
109
exports.DEFAULT_FETCH_DEPTH = 3;
1110
exports.DEFAULT_TEST_TAG_PREFIX = '';
@@ -14,6 +13,7 @@ exports.DEFAULT_SEARCH_BUILD_COMMAND_TARGETS = [
1413
'build',
1514
'production',
1615
'prod',
16+
'package',
1717
];
1818
exports.TARGET_EVENTS = {
1919
'create': [

0 commit comments

Comments
 (0)