Compare commits
423 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9560cb6d44 | ||
|
|
b6cbae3580 | ||
|
|
29acb8eaee | ||
|
|
2e976845a6 | ||
|
|
31cdbe5222 | ||
|
|
c6333d41f0 | ||
|
|
4dfc201b55 | ||
|
|
b882ee3b2a | ||
|
|
ef42af2aef | ||
|
|
f2192db227 | ||
|
|
c6eab4153b | ||
|
|
05b3340742 | ||
|
|
ad23393e24 | ||
|
|
ac980646cf | ||
|
|
4fd6bd94b6 | ||
|
|
f86ecdfe86 | ||
|
|
31b8c32f32 | ||
|
|
91a3cf4cdd | ||
|
|
89628f0310 | ||
|
|
1ceef71a57 | ||
|
|
a72f52102f | ||
|
|
4d89a385db | ||
|
|
b6801e6334 | ||
|
|
19976af8e5 | ||
|
|
f444b0ede2 | ||
|
|
51c782389a | ||
|
|
f954d4113e | ||
|
|
2165a2b5fc | ||
|
|
688a3b3d0c | ||
|
|
d2b7688ae3 | ||
|
|
70411f07e7 | ||
|
|
3971a95d5a | ||
|
|
744621d13d | ||
|
|
5d0c4dbf35 | ||
|
|
738b4dea9f | ||
|
|
852c3a3ca6 | ||
|
|
7ddf1f7f90 | ||
|
|
58b4bf3981 | ||
|
|
a117f832ce | ||
|
|
2d9155e27f | ||
|
|
37213103b1 | ||
|
|
8b93bc127f | ||
|
|
aa82aebc1d | ||
|
|
e705cf59bc | ||
|
|
215b80c84b | ||
|
|
96f4391cd5 | ||
|
|
1f596ab2b7 | ||
|
|
3de5b2308f | ||
|
|
773665f4f0 | ||
|
|
929a7d0a6a | ||
|
|
d1afc2e8ce | ||
|
|
59c0ce4284 | ||
|
|
65dc7af084 | ||
|
|
4477775802 | ||
|
|
ce787cf051 | ||
|
|
73cf1d15d9 | ||
|
|
6cad446381 | ||
|
|
c4529a59aa | ||
|
|
646a1a3881 | ||
|
|
a17e9d437e | ||
|
|
fe5636cf95 | ||
|
|
8f1f960923 | ||
|
|
5b6baff975 | ||
|
|
938e1fa9f5 | ||
|
|
fef0123d21 | ||
|
|
6b188a8022 | ||
|
|
3203c05a3a | ||
|
|
ea6d487bc7 | ||
|
|
fcbee38355 | ||
|
|
89c0c9cbfa | ||
|
|
64f3c7fc7f | ||
|
|
e150cedd96 | ||
|
|
6d42c2c3b6 | ||
|
|
a4f1f945d9 | ||
|
|
54e6a6f172 | ||
|
|
2076093b93 | ||
|
|
5a8b86ffc3 | ||
|
|
c50767dbfe | ||
|
|
e1eecfc328 | ||
|
|
f0fa0c21ed | ||
|
|
dcdf5ddc8b | ||
|
|
31d3feb0ee | ||
|
|
9597f4c0a9 | ||
|
|
489eaccb26 | ||
|
|
df4a516dab | ||
|
|
e27e4b7140 | ||
|
|
d8522eea61 | ||
|
|
cf2e9edd2a | ||
|
|
8cb34fe1e5 | ||
|
|
859ffbd0d0 | ||
|
|
d30737529f | ||
|
|
e53cc4cb81 | ||
|
|
ce66f63638 | ||
|
|
fd82b38c08 | ||
|
|
a8209677e6 | ||
|
|
489a03aac4 | ||
|
|
d6f110ce1e | ||
|
|
db632c70f2 | ||
|
|
8380af7d49 | ||
|
|
377bddc67b | ||
|
|
f621c70917 | ||
|
|
4b44fa2951 | ||
|
|
c5a0e44f79 | ||
|
|
83dbf819fb | ||
|
|
cbe2833e9b | ||
|
|
5b29ffa40d | ||
|
|
c8f4fd4c5d | ||
|
|
c639d964e8 | ||
|
|
9c52277f7b | ||
|
|
8457ade3d7 | ||
|
|
bdb15640ef | ||
|
|
f559ed8889 | ||
|
|
db3e60d230 | ||
|
|
504181401b | ||
|
|
b0da6c009f | ||
|
|
c56c9818a0 | ||
|
|
1c794ced3b | ||
|
|
0b7411e2cf | ||
|
|
750c807fa1 | ||
|
|
ae34186caa | ||
|
|
a5d411bf28 | ||
|
|
2875e4112a | ||
|
|
9d27fac8dc | ||
|
|
7501463241 | ||
|
|
b9cccec41e | ||
|
|
e782e1d323 | ||
|
|
c12a4b1908 | ||
|
|
dd1933a7b4 | ||
|
|
08093066ac | ||
|
|
c603e10bc1 | ||
|
|
5fe58fddba | ||
|
|
54a4434749 | ||
|
|
20d80bcd8c | ||
|
|
d9f616f4a2 | ||
|
|
e76c874d85 | ||
|
|
029c1a08f9 | ||
|
|
eafac7a3ef | ||
|
|
e4462d9bb6 | ||
|
|
91e6658ef0 | ||
|
|
714f710922 | ||
|
|
813be0645e | ||
|
|
a580dd75ed | ||
|
|
cf30185743 | ||
|
|
f815420c17 | ||
|
|
e5aa21b8a8 | ||
|
|
d2178821cb | ||
|
|
6462e1bf5e | ||
|
|
051ddfc79a | ||
|
|
f191fb8187 | ||
|
|
6cb5962c01 | ||
|
|
33b82d2be0 | ||
|
|
a2c82a8833 | ||
|
|
286809f3da | ||
|
|
5e3936a404 | ||
|
|
f97b3d256e | ||
|
|
7b01d765e7 | ||
|
|
4976317340 | ||
|
|
28e7732e93 | ||
|
|
390b063535 | ||
|
|
50bcf7b81d | ||
|
|
1511f85feb | ||
|
|
db7681db4d | ||
|
|
eda4527add | ||
|
|
0ab035e1c1 | ||
|
|
af61d81606 | ||
|
|
86114bb2c7 | ||
|
|
1139364d4c | ||
|
|
e3404eb04b | ||
|
|
c1bc06c3e6 | ||
|
|
8632feabc7 | ||
|
|
7d421d3e4c | ||
|
|
95d87cfaa5 | ||
|
|
cfc119fff7 | ||
|
|
4b0ac9453b | ||
|
|
b7c9581509 | ||
|
|
fd97637134 | ||
|
|
f69bcb9ae8 | ||
|
|
f1ebad9abb | ||
|
|
63cdebd96b | ||
|
|
4f693f0ddb | ||
|
|
1828d864ae | ||
|
|
dbc1ba3666 | ||
|
|
df5698c4aa | ||
|
|
9614091a5e | ||
|
|
98e0f6025c | ||
|
|
8dd38bec4d | ||
|
|
ddf2c5b9f1 | ||
|
|
d8356e3cf1 | ||
|
|
fb15409be9 | ||
|
|
9f90987bad | ||
|
|
596c2d5548 | ||
|
|
b6bc5040aa | ||
|
|
6fcf128c18 | ||
|
|
bf8dc2ce19 | ||
|
|
abd7ea550b | ||
|
|
ab7b255432 | ||
|
|
8af9b8c0d5 | ||
|
|
a07d7115c5 | ||
|
|
20e19cf1eb | ||
|
|
da14e08646 | ||
|
|
046c703d6d | ||
|
|
ab371259dd | ||
|
|
711b0ed1cd | ||
|
|
e5063fa6dd | ||
|
|
58be994809 | ||
|
|
6d889ad7e9 | ||
|
|
37ce049d08 | ||
|
|
32a0227f7c | ||
|
|
c742786fc9 | ||
|
|
7f9aba2ea8 | ||
|
|
d48d5de82e | ||
|
|
78d67e4cbe | ||
|
|
7c0ae727e6 | ||
|
|
af6a5970d8 | ||
|
|
3789ef4a0a | ||
|
|
42a3ae6a38 | ||
|
|
a93c85ca96 | ||
|
|
ed5a99d637 | ||
|
|
45a2a58fb0 | ||
|
|
042b824d8b | ||
|
|
ca2c254157 | ||
|
|
3ed76c92c6 | ||
|
|
e26a05e473 | ||
|
|
d59e15bbd0 | ||
|
|
3e53047dc0 | ||
|
|
339315a4b0 | ||
|
|
f5eb08fafc | ||
|
|
c276f65cf9 | ||
|
|
9dddc3350f | ||
|
|
0a1633ac31 | ||
|
|
164addf07d | ||
|
|
fbff0cd1e0 | ||
|
|
9597ab97de | ||
|
|
014420965c | ||
|
|
87399813a5 | ||
|
|
2ea85f7322 | ||
|
|
e31acce9d3 | ||
|
|
25deb782d0 | ||
|
|
0e2b180da6 | ||
|
|
1b904544aa | ||
|
|
85823c67e1 | ||
|
|
3183d3481b | ||
|
|
2be10a7999 | ||
|
|
9f0d4d44b9 | ||
|
|
669db9c5d1 | ||
|
|
75680dae34 | ||
|
|
465b328f75 | ||
|
|
7c4605913c | ||
|
|
618acc18f3 | ||
|
|
36c6bd42bd | ||
|
|
bb022f3294 | ||
|
|
1a3f0fd0f6 | ||
|
|
4933c8ef88 | ||
|
|
ecd8e7bc48 | ||
|
|
04cd6de8fd | ||
|
|
8019d941f3 | ||
|
|
cf8d655310 | ||
|
|
6cf4da4de2 | ||
|
|
148a6573c6 | ||
|
|
0294e8c526 | ||
|
|
2a787f0182 | ||
|
|
62dcd84517 | ||
|
|
7c5e9bef11 | ||
|
|
3f58382eea | ||
|
|
c50f9fd17d | ||
|
|
1ee7d6e98a | ||
|
|
e2a54ec0b9 | ||
|
|
9794f98ff1 | ||
|
|
ba0b7df03e | ||
|
|
87a781f6ce | ||
|
|
6fa13fefb3 | ||
|
|
efb69e1873 | ||
|
|
9d932c08b7 | ||
|
|
53c9fb0da1 | ||
|
|
d6bd6182f2 | ||
|
|
01fdaf2f02 | ||
|
|
75c03d0413 | ||
|
|
ade70d3851 | ||
|
|
abaaadb545 | ||
|
|
4f06df820b | ||
|
|
ff31e77830 | ||
|
|
81f05c5524 | ||
|
|
60edcea535 | ||
|
|
2fa0a59e21 | ||
|
|
d1f987783c | ||
|
|
0466bfb243 | ||
|
|
a228296ccf | ||
|
|
77664235e1 | ||
|
|
a1ff787715 | ||
|
|
b2788ae3c6 | ||
|
|
680198766b | ||
|
|
7f32718f66 | ||
|
|
0404476337 | ||
|
|
221953c929 | ||
|
|
dd094624d6 | ||
|
|
a7bc3c37fd | ||
|
|
c279167199 | ||
|
|
a4c25ca778 | ||
|
|
9571d29e0d | ||
|
|
f3b165fbe1 | ||
|
|
eb73e9cb9d | ||
|
|
860ed1944f | ||
|
|
945c44d50a | ||
|
|
d8ed36f54a | ||
|
|
d2d8e21d7e | ||
|
|
80c8fe5fb3 | ||
|
|
81884efe7c | ||
|
|
618792b2f0 | ||
|
|
86214f3d79 | ||
|
|
68520436f8 | ||
|
|
fab0628782 | ||
|
|
73ceb68759 | ||
|
|
162bc9ee63 | ||
|
|
b76751b9ee | ||
|
|
dc1169c5ba | ||
|
|
ade8887479 | ||
|
|
2a9e88ed57 | ||
|
|
a65bea57e7 | ||
|
|
9fd8cd10e7 | ||
|
|
fd6e5fc7ce | ||
|
|
acd0462710 | ||
|
|
9faed51ce9 | ||
|
|
7c45cb42ca | ||
|
|
ac39f89062 | ||
|
|
dd0b5dfc69 | ||
|
|
140391da91 | ||
|
|
50988c17ae | ||
|
|
a4da635d8c | ||
|
|
56fe697825 | ||
|
|
bc18026d43 | ||
|
|
ce61f4bf52 | ||
|
|
b81e21a3dc | ||
|
|
79cc24d126 | ||
|
|
364c31d33b | ||
|
|
3c65337a25 | ||
|
|
7b12ca9aeb | ||
|
|
62e7849d7a | ||
|
|
e0af1f7de0 | ||
|
|
67f77416c9 | ||
|
|
d0ac7fa637 | ||
|
|
da23196fc5 | ||
|
|
00fde1eb97 | ||
|
|
6244b197b6 | ||
|
|
e58a6c156e | ||
|
|
b243cafb6e | ||
|
|
5d3cd509d9 | ||
|
|
0b1dd44709 | ||
|
|
e1bf32ad68 | ||
|
|
61b479a8a4 | ||
|
|
8a36604631 | ||
|
|
a8fa52a354 | ||
|
|
74f652acfd | ||
|
|
7b9b3b3f5f | ||
|
|
43687c847a | ||
|
|
218e357d06 | ||
|
|
2f5ccc92df | ||
|
|
195ab8005d | ||
|
|
591c4bdf2e | ||
|
|
1c50baa294 | ||
|
|
73c09c703e | ||
|
|
55a68e34ca | ||
|
|
60c31d23a8 | ||
|
|
1887981f72 | ||
|
|
49a6939dbb | ||
|
|
0b00dd2a9f | ||
|
|
5d5e9338cc | ||
|
|
8b52b41ecb | ||
|
|
0a1a58196b | ||
|
|
476fa94197 | ||
|
|
0e542f9f92 | ||
|
|
aec195ebb4 | ||
|
|
41015898aa | ||
|
|
a7866b5bd3 | ||
|
|
752214aa33 | ||
|
|
0b24a9f462 | ||
|
|
354d78ff6f | ||
|
|
7605281c4b | ||
|
|
2948e5eda8 | ||
|
|
e8d0817a48 | ||
|
|
9d8382b381 | ||
|
|
8ccc2d9608 | ||
|
|
1b6740cb30 | ||
|
|
479c59e6d2 | ||
|
|
a22f6fc3b7 | ||
|
|
f28cc017a9 | ||
|
|
f8b5a36401 | ||
|
|
848165cf9f | ||
|
|
fb54d6af4d | ||
|
|
6edc4c9764 | ||
|
|
d35854bdf8 | ||
|
|
f0177d176f | ||
|
|
0ba5bf3eeb | ||
|
|
cfdf8c43ed | ||
|
|
ce8c273a61 | ||
|
|
5378bd89b8 | ||
|
|
db62f9acd4 | ||
|
|
ed21b6a594 | ||
|
|
9f11da81ae | ||
|
|
a1375a4637 | ||
|
|
1a26eaca33 | ||
|
|
1a13108865 | ||
|
|
d0de38a352 | ||
|
|
b3cfcb13c0 | ||
|
|
b1aaa85b67 | ||
|
|
f1e7cd608c | ||
|
|
07a3f2915e | ||
|
|
02c38586a5 | ||
|
|
59bbb98387 | ||
|
|
9b3fcdf515 | ||
|
|
be27dcce48 | ||
|
|
ccf71d1162 | ||
|
|
5fe4aa3f24 | ||
|
|
428902c6cd | ||
|
|
00bca7b88c | ||
|
|
c940278a4c | ||
|
|
9cec798451 | ||
|
|
ec95e8e7aa | ||
|
|
5570fc7c70 | ||
|
|
4a69c2d60c | ||
|
|
f990e1a2a0 | ||
|
|
0629babb09 | ||
|
|
a150e4e690 | ||
|
|
ec09a8863c |
@@ -1,9 +0,0 @@
|
|||||||
version: 1
|
|
||||||
update_configs:
|
|
||||||
- package_manager: "javascript"
|
|
||||||
directory: "/"
|
|
||||||
update_schedule: "daily"
|
|
||||||
default_labels:
|
|
||||||
- "dependencies"
|
|
||||||
commit_message:
|
|
||||||
prefix: "deps"
|
|
||||||
@@ -6,10 +6,13 @@
|
|||||||
},
|
},
|
||||||
"extends": [
|
"extends": [
|
||||||
"eslint:recommended",
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:@typescript-eslint/recommended",
|
||||||
"plugin:@typescript-eslint/recommended",
|
"plugin:jest/recommended",
|
||||||
"plugin:jest/recommended"
|
"plugin:prettier/recommended",
|
||||||
|
"prettier/@typescript-eslint"
|
||||||
],
|
],
|
||||||
|
"plugins": ["@typescript-eslint"],
|
||||||
"globals": {
|
"globals": {
|
||||||
"Atomics": "readonly",
|
"Atomics": "readonly",
|
||||||
"SharedArrayBuffer": "readonly"
|
"SharedArrayBuffer": "readonly"
|
||||||
|
|||||||
36
.github/ISSUE_TEMPLATE/1_user_support.md
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
---
|
||||||
|
name: User Support
|
||||||
|
about: Questions for this Action
|
||||||
|
title: 'sample_title'
|
||||||
|
labels: support
|
||||||
|
assignees: peaceiris
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Note that an issue which does not follow the template will be closed silently. -->
|
||||||
|
|
||||||
|
### Check list before opening this issue
|
||||||
|
|
||||||
|
- [ ] I read the latest README
|
||||||
|
- I checked [Available Options](https://github.com/peaceiris/actions-gh-pages#options)
|
||||||
|
- I followed [Tips and FAQ](https://github.com/peaceiris/actions-gh-pages#tips-and-faq)
|
||||||
|
- I tried [Workflow Examples](https://github.com/peaceiris/actions-gh-pages#examples)
|
||||||
|
- I read the latest GitHub Actions official documentation and learned the basic spec and concepts
|
||||||
|
|
||||||
|
### Describe your question
|
||||||
|
|
||||||
|
<!-- A clear and concise description of what the question is. -->
|
||||||
|
|
||||||
|
### Link to your contents
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- Link to your public repository here
|
||||||
|
- Link to your workflow here
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Screenshots
|
||||||
|
|
||||||
|
<!-- If applicable, add screenshots to help explain your question. -->
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
|
||||||
|
<!-- Add any other context about the problem here. -->
|
||||||
44
.github/ISSUE_TEMPLATE/2_bug_report.md
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
name: Bug Report
|
||||||
|
about: First, use the User Support Issue Template
|
||||||
|
title: 'sample_title'
|
||||||
|
labels: bug
|
||||||
|
assignees: peaceiris
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Note that an issue which does not follow the template will be closed silently. -->
|
||||||
|
|
||||||
|
### Describe the bug
|
||||||
|
|
||||||
|
<!-- A clear and concise description of what the bug is. -->
|
||||||
|
|
||||||
|
### To Reproduce
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
|
||||||
|
<!-- A clear and concise description of what you expected to happen. -->
|
||||||
|
|
||||||
|
### Screenshots
|
||||||
|
|
||||||
|
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||||
|
|
||||||
|
### Your YAML file
|
||||||
|
|
||||||
|
<!--
|
||||||
|
- A link to your repository
|
||||||
|
- A link to your YAML file
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
|
||||||
|
<!-- Add any other context about the problem here. -->
|
||||||
26
.github/ISSUE_TEMPLATE/3_proposal.md
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
name: Proposal
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: 'sample_title'
|
||||||
|
labels: proposal
|
||||||
|
assignees: peaceiris
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Note that an issue which does not follow the template will be closed silently. -->
|
||||||
|
|
||||||
|
### Is your feature request related to a problem? Please describe
|
||||||
|
|
||||||
|
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||||
|
|
||||||
|
### Describe the solution you'd like
|
||||||
|
|
||||||
|
<!-- A clear and concise description of what you want to happen. -->
|
||||||
|
|
||||||
|
### Describe alternatives you've considered
|
||||||
|
|
||||||
|
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
||||||
|
|
||||||
|
### Additional context
|
||||||
|
|
||||||
|
<!-- Add any other context or screenshots about the feature request here. -->
|
||||||
31
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
title: 'Bug: This is a sample issue title'
|
|
||||||
labels: bug
|
|
||||||
assignees: peaceiris
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**To Reproduce**
|
|
||||||
Steps to reproduce the behavior:
|
|
||||||
1. Go to '...'
|
|
||||||
2. Click on '....'
|
|
||||||
3. Scroll down to '....'
|
|
||||||
4. See error
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Screenshots**
|
|
||||||
If applicable, add screenshots to help explain your problem.
|
|
||||||
|
|
||||||
**Your YAML file**
|
|
||||||
- A link to your repository
|
|
||||||
- A link to your YAML file
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
||||||
11
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +1,11 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: GitHub Actions Community Forum
|
- name: GitHub Actions - GitHub Support Community Forum
|
||||||
url: https://github.community/t5/GitHub-Actions/bd-p/actions
|
url: https://github.community/c/github-actions
|
||||||
about: Please ask questions about GitHub Actions here.
|
about: Please ask questions about GitHub Actions here.
|
||||||
- name: GitHub Pages help
|
- name: GitHub Pages Documentation
|
||||||
url: https://help.github.com/en/github/working-with-github-pages
|
url: https://help.github.com/en/github/working-with-github-pages
|
||||||
about: GitHub Pages documentaion here.
|
about: GitHub Pages official documentaion here.
|
||||||
|
- name: GitHub Actions Documentation
|
||||||
|
url: https://help.github.com/en/actions
|
||||||
|
about: GitHub Actions official documentaion here.
|
||||||
|
|||||||
20
.github/ISSUE_TEMPLATE/proposal.md
vendored
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: Proposal
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: 'proposal: This is a sample title'
|
|
||||||
labels: proposal
|
|
||||||
assignees: peaceiris
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
26
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
time: '11:00'
|
||||||
|
timezone: Japan
|
||||||
|
labels:
|
||||||
|
- dependencies
|
||||||
|
ignore:
|
||||||
|
- dependency-name: "@types/node"
|
||||||
|
versions:
|
||||||
|
- ">= 13.a, < 14"
|
||||||
|
- ">= 14.a, < 15"
|
||||||
|
commit-message:
|
||||||
|
prefix: deps
|
||||||
|
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
labels:
|
||||||
|
- "dependencies:ci"
|
||||||
|
commit-message:
|
||||||
|
prefix: ci
|
||||||
29
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: "Code Scanning"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
CodeQL-Build:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
|
||||||
|
- run: git checkout HEAD^2
|
||||||
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: javascript
|
||||||
|
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
43
.github/workflows/dev-image.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: 'Dev Image CI'
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/dev-image.yml'
|
||||||
|
- '.dockerignore'
|
||||||
|
- '.nvmrc'
|
||||||
|
- 'Dockerfile'
|
||||||
|
- 'Makefile'
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/dev-image.yml'
|
||||||
|
- '.dockerignore'
|
||||||
|
- '.nvmrc'
|
||||||
|
- 'Dockerfile'
|
||||||
|
- 'Makefile'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
skipci:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- run: echo "[skip ci] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
||||||
|
|
||||||
|
dev-image-test:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2.3.1
|
||||||
|
- name: Login to Packages
|
||||||
|
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login 'docker.pkg.github.com' -u 'peaceiris' --password-stdin
|
||||||
|
- run: make pull
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
- run: make build
|
||||||
|
- run: make cirun cmd="npm ci"
|
||||||
|
- run: make ciall
|
||||||
|
- run: make push
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
14
.github/workflows/pages-status-check.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
name: Check Pages Status
|
||||||
|
|
||||||
|
on: page_build
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pages-status-check:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- name: check status
|
||||||
|
run: |
|
||||||
|
status = '${{ github.event.build.status }}'
|
||||||
|
errormsg = '${{ github.event.build.error.message }}'
|
||||||
|
assert status == 'built', 'Status: {status}\nError: {errormsg}'.format(status, errormsg)
|
||||||
|
shell: python
|
||||||
@@ -3,6 +3,7 @@ name: Purge image cache
|
|||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '54 18 * * */7'
|
- cron: '54 18 * * */7'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
purge:
|
purge:
|
||||||
|
|||||||
9
.github/workflows/release.yml
vendored
@@ -3,14 +3,13 @@ name: Release
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v3.*.*'
|
- 'v3.*.*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v2.3.1
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Dump GitHub context
|
- name: Dump GitHub context
|
||||||
env:
|
env:
|
||||||
@@ -19,8 +18,8 @@ jobs:
|
|||||||
|
|
||||||
- name: Install github/hub
|
- name: Install github/hub
|
||||||
run: |
|
run: |
|
||||||
export HUB_VERSION="2.14.1"
|
export HUB_VERSION="2.14.2"
|
||||||
curl -fsSL https://github.com/github/hub/raw/40e421edd2c63d57bb8daa4bb9bbdfa21e8becf9/script/get | bash -s "${HUB_VERSION}"
|
curl -fsSL https://github.com/github/hub/raw/8d91904208171b013f9a9d1175f4ab39068db047/script/get | bash -s "${HUB_VERSION}"
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
env:
|
env:
|
||||||
|
|||||||
17
.github/workflows/stale.yml
vendored
@@ -1,17 +0,0 @@
|
|||||||
name: "Stale"
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "6 6 * * *"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stale:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/stale@v1
|
|
||||||
with:
|
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
stale-issue-message: 'This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
|
||||||
stale-pr-message: 'This pull request is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
|
|
||||||
days-before-stale: 21
|
|
||||||
days-before-close: 7
|
|
||||||
86
.github/workflows/test-action.yml
vendored
@@ -1,86 +0,0 @@
|
|||||||
name: Test Action
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
paths-ignore:
|
|
||||||
- '*.md'
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
paths-ignore:
|
|
||||||
- '*.md'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
skipci:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
|
||||||
|
|
||||||
test:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
- 'ubuntu-18.04'
|
|
||||||
# - 'macos-latest'
|
|
||||||
# - 'windows-latest'
|
|
||||||
steps:
|
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Read .nvmrc
|
|
||||||
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
|
||||||
id: nvm
|
|
||||||
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v1
|
|
||||||
with:
|
|
||||||
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
|
||||||
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm run build
|
|
||||||
|
|
||||||
- name: Setup mdBook
|
|
||||||
uses: peaceiris/actions-mdbook@v1
|
|
||||||
with:
|
|
||||||
mdbook-version: '0.3.5'
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
working-directory: ./test_projects/mdbook
|
|
||||||
run: mdbook build
|
|
||||||
|
|
||||||
- name: Prepare tag
|
|
||||||
id: prepare_tag
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
run: |
|
|
||||||
TAG_NAME="${GITHUB_REF##refs/tags/}"
|
|
||||||
echo "::set-output name=tag_name::${TAG_NAME}"
|
|
||||||
echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}"
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
|
||||||
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
# publish_branch: master
|
|
||||||
publish_dir: ./test_projects/mdbook/book
|
|
||||||
# external_repository: ''
|
|
||||||
allow_empty_commit: true
|
|
||||||
# keep_files: true
|
|
||||||
force_orphan: true
|
|
||||||
# user_name: iris
|
|
||||||
# user_email: email@peaceiris.com
|
|
||||||
# commit_message: ${{ github.event.head_commit.message }}
|
|
||||||
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
|
|
||||||
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
|
|
||||||
|
|
||||||
# - name: Deploy v2
|
|
||||||
# uses: peaceiris/actions-gh-pages@v2
|
|
||||||
# env:
|
|
||||||
# ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
|
||||||
# PUBLISH_BRANCH: gh-pages
|
|
||||||
# PUBLISH_DIR: ./test_projects/mdbook/book
|
|
||||||
156
.github/workflows/test.yml
vendored
@@ -7,58 +7,176 @@ on:
|
|||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '*.md'
|
- '*.md'
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '*.md'
|
- '*.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
skipci:
|
|
||||||
runs-on: ubuntu-18.04
|
|
||||||
steps:
|
|
||||||
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
|
- 'ubuntu-20.04'
|
||||||
- 'ubuntu-18.04'
|
- 'ubuntu-18.04'
|
||||||
|
- 'ubuntu-16.04'
|
||||||
- 'macos-latest'
|
- 'macos-latest'
|
||||||
- 'windows-latest'
|
- 'windows-latest'
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v2.3.1
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- name: Dump GitHub context
|
||||||
|
env:
|
||||||
|
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||||
|
run: echo "${GITHUB_CONTEXT}"
|
||||||
|
|
||||||
- name: Read .nvmrc
|
- name: Read .nvmrc
|
||||||
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
||||||
id: nvm
|
id: nvm
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v2.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||||
|
|
||||||
|
- run: npm i -g npm
|
||||||
|
|
||||||
|
- name: Dump version
|
||||||
|
run: |
|
||||||
|
node -v
|
||||||
|
npm --version
|
||||||
|
git --version
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
|
||||||
- name: Run prettier
|
- name: Run prettier
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
if: startsWith(matrix.os, 'ubuntu-18.04')
|
||||||
run: npm run format:check
|
run: npm run format:check
|
||||||
|
|
||||||
- name: Run eslint
|
- name: Run eslint
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
if: startsWith(matrix.os, 'ubuntu-18.04')
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|
||||||
- name: Run ncc
|
|
||||||
if: startsWith(matrix.os, 'ubuntu')
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- run: npm test
|
- run: npm test
|
||||||
|
|
||||||
- name: Upload test coverage as artifact
|
- name: Upload test coverage as artifact
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: coverage
|
name: coverage-${{ matrix.os }}
|
||||||
path: coverage
|
path: coverage
|
||||||
|
|
||||||
|
- uses: codecov/codecov-action@v1.0.10
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
- name: Run ncc
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Remove lint-staged husky
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: |
|
||||||
|
npm uninstall lint-staged husky
|
||||||
|
git checkout package-lock.json package.json
|
||||||
|
|
||||||
|
- name: Setup mdBook
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
uses: peaceiris/actions-mdbook@v1.1.12
|
||||||
|
with:
|
||||||
|
mdbook-version: '0.3.7'
|
||||||
|
|
||||||
|
- name: Build site
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
working-directory: ./test_projects/mdbook
|
||||||
|
run: mdbook build
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
if: |
|
||||||
|
startsWith(matrix.os, 'ubuntu-18.04') &&
|
||||||
|
github.ref == 'refs/heads/master'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# publish_branch: gh-pages
|
||||||
|
publish_dir: ./test_projects/mdbook/book
|
||||||
|
# external_repository: ''
|
||||||
|
allow_empty_commit: true
|
||||||
|
# keep_files: true
|
||||||
|
# force_orphan: true
|
||||||
|
user_name: 'github-actions[bot]'
|
||||||
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
||||||
|
# commit_message: ${{ github.event.head_commit.message }}
|
||||||
|
cname: 'actions-gh-pages.peaceiris.com'
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
if: |
|
||||||
|
startsWith(matrix.os, 'ubuntu-16.04') &&
|
||||||
|
github.ref == 'refs/heads/master'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||||
|
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_branch: gh-pages-ubuntu-16.04
|
||||||
|
publish_dir: ./test_projects/mdbook/book
|
||||||
|
# external_repository: ''
|
||||||
|
allow_empty_commit: true
|
||||||
|
keep_files: true
|
||||||
|
force_orphan: true
|
||||||
|
user_name: 'github-actions[bot]'
|
||||||
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
||||||
|
full_commit_message: ${{ github.event.head_commit.message }}
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
if: |
|
||||||
|
startsWith(matrix.os, 'macos') &&
|
||||||
|
github.ref == 'refs/heads/master'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||||
|
# github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# personal_token: ${{ secrets.PERSONAL_TOKEN }}
|
||||||
|
publish_branch: gh-pages-macos
|
||||||
|
publish_dir: ./test_projects/mdbook/book
|
||||||
|
# external_repository: ''
|
||||||
|
allow_empty_commit: true
|
||||||
|
# keep_files: true
|
||||||
|
# force_orphan: true
|
||||||
|
user_name: 'github-actions[bot]'
|
||||||
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
||||||
|
# commit_message: ${{ github.event.head_commit.message }}
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
if: |
|
||||||
|
startsWith(matrix.os, 'windows') &&
|
||||||
|
github.ref == 'refs/heads/master'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# personal_token: ${{ secrets.PERSONAL_TOKEN }}
|
||||||
|
publish_branch: gh-pages-windows
|
||||||
|
publish_dir: ./test_projects/mdbook/book
|
||||||
|
# external_repository: ''
|
||||||
|
allow_empty_commit: true
|
||||||
|
# keep_files: true
|
||||||
|
# force_orphan: true
|
||||||
|
user_name: 'github-actions[bot]'
|
||||||
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
||||||
|
# commit_message: ${{ github.event.head_commit.message }}
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
if: |
|
||||||
|
startsWith(matrix.os, 'ubuntu-20.04') &&
|
||||||
|
github.ref == 'refs/heads/master'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_branch: gh-pages-ubuntu-20.04
|
||||||
|
publish_dir: ./test_projects/mdbook/book
|
||||||
|
# external_repository: ''
|
||||||
|
allow_empty_commit: true
|
||||||
|
# keep_files: true
|
||||||
|
# force_orphan: true
|
||||||
|
user_name: 'github-actions[bot]'
|
||||||
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
||||||
|
# commit_message: ${{ github.event.head_commit.message }}
|
||||||
|
|||||||
2
.github/workflows/update-major-tag.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
|||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2.3.1
|
||||||
|
|
||||||
- name: Update major tag
|
- name: Update major tag
|
||||||
if: github.event.release.prerelease == false
|
if: github.event.release.prerelease == false
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"printWidth": 80,
|
"printWidth": 100,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
|
|||||||
3
.vscode/settings.json
vendored
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"git.ignoreLimitWarning": true
|
"git.ignoreLimitWarning": true,
|
||||||
|
"deno.enable": false
|
||||||
}
|
}
|
||||||
1100
CHANGELOG.md
@@ -10,11 +10,13 @@ RUN apt-get update && \
|
|||||||
libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev autoconf \
|
libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev autoconf \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
wget \
|
wget \
|
||||||
ssh && \
|
ssh \
|
||||||
rm -rf /var/lib/apt/lists/*
|
vim && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
npm i -g npm
|
||||||
|
|
||||||
WORKDIR /git
|
WORKDIR /git
|
||||||
ENV GIT_VERSION="2.25.0"
|
ENV GIT_VERSION="2.27.0"
|
||||||
RUN wget -q "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz" && \
|
RUN wget -q "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz" && \
|
||||||
tar -zxf "./v${GIT_VERSION}.tar.gz" && \
|
tar -zxf "./v${GIT_VERSION}.tar.gz" && \
|
||||||
rm "./v${GIT_VERSION}.tar.gz" && \
|
rm "./v${GIT_VERSION}.tar.gz" && \
|
||||||
|
|||||||
29
Makefile
@@ -1,19 +1,34 @@
|
|||||||
cmd := "bash"
|
cmd := "bash"
|
||||||
msg := ""
|
msg := ""
|
||||||
IMAGE_NAME := actions_github_pages_dev:latest
|
IMAGE_NAME := docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest
|
||||||
NODE_VERSION := $(shell cat ./.nvmrc)
|
NODE_VERSION := $(shell cat ./.nvmrc)
|
||||||
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
|
|
||||||
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
|
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
|
||||||
|
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
|
||||||
|
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
$(DOCKER_BUILD)
|
docker build . \
|
||||||
|
--build-arg NODE_VERSION=$(NODE_VERSION) \
|
||||||
|
--cache-from=${IMAGE_NAME} \
|
||||||
|
-t $(IMAGE_NAME)
|
||||||
|
|
||||||
|
.PHONY: pull
|
||||||
|
pull:
|
||||||
|
docker pull ${IMAGE_NAME}
|
||||||
|
|
||||||
|
.PHONY: push
|
||||||
|
push:
|
||||||
|
docker push ${IMAGE_NAME}
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run:
|
run:
|
||||||
$(DOCKER_RUN) $(cmd)
|
$(DOCKER_RUN) $(cmd)
|
||||||
|
|
||||||
|
.PHONY: cirun
|
||||||
|
cirun:
|
||||||
|
$(DOCKER_RUN_CI) $(cmd)
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
$(DOCKER_RUN) npm test
|
$(DOCKER_RUN) npm test
|
||||||
@@ -21,3 +36,11 @@ test:
|
|||||||
.PHONY: commit
|
.PHONY: commit
|
||||||
commit:
|
commit:
|
||||||
$(DOCKER_RUN) git commit -m "$(msg)"
|
$(DOCKER_RUN) git commit -m "$(msg)"
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all:
|
||||||
|
$(DOCKER_RUN) npm run all
|
||||||
|
|
||||||
|
.PHONY: ciall
|
||||||
|
ciall:
|
||||||
|
$(DOCKER_RUN_CI) npm run all
|
||||||
|
|||||||
@@ -1,44 +1,104 @@
|
|||||||
// import * as main from '../src/main';
|
// import * as main from '../src/main';
|
||||||
import {Inputs} from '../src/interfaces';
|
import {Inputs} from '../src/interfaces';
|
||||||
import {getInputs} from '../src/get-inputs';
|
import {showInputs, getInputs} from '../src/get-inputs';
|
||||||
|
import os from 'os';
|
||||||
|
import fs from 'fs';
|
||||||
|
import yaml from 'js-yaml';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.resetModules();
|
jest.resetModules();
|
||||||
|
process.stdout.write = jest.fn();
|
||||||
|
|
||||||
|
const doc = yaml.safeLoad(fs.readFileSync(__dirname + '/../action.yml', 'utf8'));
|
||||||
|
Object.keys(doc.inputs).forEach(name => {
|
||||||
|
const envVar = `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||||
|
process.env[envVar] = doc.inputs[name]['default'];
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
delete process.env['INPUT_DEPLOY_KEY'];
|
const doc = yaml.safeLoad(fs.readFileSync(__dirname + '/../action.yml', 'utf8'));
|
||||||
delete process.env['INPUT_GITHUB_TOKEN'];
|
Object.keys(doc.inputs).forEach(name => {
|
||||||
delete process.env['INPUT_PERSONAL_TOKEN'];
|
const envVar = `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||||
delete process.env['INPUT_PUBLISH_BRANCH'];
|
console.debug(`delete ${envVar}\t${process.env[envVar]}`);
|
||||||
delete process.env['INPUT_PUBLISH_DIR'];
|
delete process.env[envVar];
|
||||||
delete process.env['INPUT_EXTERNAL_REPOSITORY'];
|
});
|
||||||
delete process.env['INPUT_ALLOW_EMPTY_COMMIT'];
|
});
|
||||||
delete process.env['INPUT_KEEP_FILES'];
|
|
||||||
delete process.env['INPUT_FORCE_ORPHAN'];
|
// Assert that process.stdout.write calls called only with the given arguments.
|
||||||
delete process.env['INPUT_USER_NAME'];
|
// cf. https://github.com/actions/toolkit/blob/8b0300129f08728419263b016de8630f1d426d5f/packages/core/__tests__/core.test.ts
|
||||||
delete process.env['INPUT_USER_EMAIL'];
|
function assertWriteCalls(calls: string[]): void {
|
||||||
delete process.env['INPUT_COMMIT_MESSAGE'];
|
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length);
|
||||||
delete process.env['INPUT_TAG_NAME'];
|
|
||||||
delete process.env['INPUT_TAG_MESSAGE'];
|
for (let i = 0; i < calls.length; i++) {
|
||||||
|
expect(process.stdout.write).toHaveBeenNthCalledWith(i + 1, calls[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getInputsLog(authMethod: string, inps: Inputs): string {
|
||||||
|
return `\
|
||||||
|
[INFO] ${authMethod}: true
|
||||||
|
[INFO] PublishBranch: ${inps.PublishBranch}
|
||||||
|
[INFO] PublishDir: ${inps.PublishDir}
|
||||||
|
[INFO] ExternalRepository: ${inps.ExternalRepository}
|
||||||
|
[INFO] AllowEmptyCommit: ${inps.AllowEmptyCommit}
|
||||||
|
[INFO] KeepFiles: ${inps.KeepFiles}
|
||||||
|
[INFO] ForceOrphan: ${inps.ForceOrphan}
|
||||||
|
[INFO] UserName: ${inps.UserName}
|
||||||
|
[INFO] UserEmail: ${inps.UserEmail}
|
||||||
|
[INFO] CommitMessage: ${inps.CommitMessage}
|
||||||
|
[INFO] FullCommitMessage: ${inps.FullCommitMessage}
|
||||||
|
[INFO] TagName: ${inps.TagName}
|
||||||
|
[INFO] TagMessage: ${inps.TagMessage}
|
||||||
|
[INFO] EnableJekyll (DisableNoJekyll): ${inps.DisableNoJekyll}
|
||||||
|
[INFO] CNAME: ${inps.CNAME}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('showInputs()', () => {
|
||||||
|
// eslint-disable-next-line jest/expect-expect
|
||||||
|
test('print all inputs DeployKey', () => {
|
||||||
|
process.env['INPUT_DEPLOY_KEY'] = 'test_deploy_key';
|
||||||
|
|
||||||
|
const inps: Inputs = getInputs();
|
||||||
|
showInputs(inps);
|
||||||
|
|
||||||
|
const authMethod = 'DeployKey';
|
||||||
|
const test = getInputsLog(authMethod, inps);
|
||||||
|
assertWriteCalls([`${test}${os.EOL}`]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line jest/expect-expect
|
||||||
|
test('print all inputs GithubToken', () => {
|
||||||
|
delete process.env['INPUT_DEPLOY_KEY'];
|
||||||
|
process.env['INPUT_GITHUB_TOKEN'] = 'test_github_token';
|
||||||
|
|
||||||
|
const inps: Inputs = getInputs();
|
||||||
|
showInputs(inps);
|
||||||
|
|
||||||
|
const authMethod = 'GithubToken';
|
||||||
|
const test = getInputsLog(authMethod, inps);
|
||||||
|
assertWriteCalls([`${test}${os.EOL}`]);
|
||||||
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line jest/expect-expect
|
||||||
|
test('print all inputs PersonalToken', () => {
|
||||||
|
delete process.env['INPUT_DEPLOY_KEY'];
|
||||||
|
delete process.env['INPUT_GITHUB_TOKEN'];
|
||||||
|
process.env['INPUT_PERSONAL_TOKEN'] = 'test_personal_token';
|
||||||
|
|
||||||
|
const inps: Inputs = getInputs();
|
||||||
|
showInputs(inps);
|
||||||
|
|
||||||
|
const authMethod = 'PersonalToken';
|
||||||
|
const test = getInputsLog(authMethod, inps);
|
||||||
|
assertWriteCalls([`${test}${os.EOL}`]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getInputs()', () => {
|
describe('getInputs()', () => {
|
||||||
test('get default inputs', () => {
|
test('get default inputs', () => {
|
||||||
process.env['INPUT_DEPLOY_KEY'] = 'test_deploy_key';
|
process.env['INPUT_DEPLOY_KEY'] = 'test_deploy_key';
|
||||||
// process.env['INPUT_GITHUB_TOKEN'] = 'test_github_token';
|
|
||||||
// process.env['INPUT_PERSONAL_TOKEN'] = 'test_personal_token';
|
|
||||||
process.env['INPUT_PUBLISH_BRANCH'] = 'gh-pages';
|
|
||||||
process.env['INPUT_PUBLISH_DIR'] = 'public';
|
|
||||||
// process.env['INPUT_EXTERNAL_REPOSITORY'] = 'user/repo';
|
|
||||||
// process.env['INPUT_ALLOW_EMPTY_COMMIT'] = 'true';
|
|
||||||
// process.env['INPUT_KEEP_FILES'] = 'true';
|
|
||||||
// process.env['INPUT_FORCE_ORPHAN'] = 'true';
|
|
||||||
// process.env['INPUT_USER_NAME'] = 'username';
|
|
||||||
// process.env['INPUT_USER_EMAIL'] = 'github@github.com';
|
|
||||||
// process.env['INPUT_COMMIT_MESSAGE'] = 'feat: Add new feature';
|
|
||||||
// process.env['INPUT_TAG_NAME'] = 'deploy-v1.2.3';
|
|
||||||
// process.env['INPUT_TAG_MESSAGE'] = 'Deployment v1.2.3';
|
|
||||||
|
|
||||||
const inps: Inputs = getInputs();
|
const inps: Inputs = getInputs();
|
||||||
|
|
||||||
@@ -54,8 +114,11 @@ describe('getInputs()', () => {
|
|||||||
expect(inps.UserName).toMatch('');
|
expect(inps.UserName).toMatch('');
|
||||||
expect(inps.UserEmail).toMatch('');
|
expect(inps.UserEmail).toMatch('');
|
||||||
expect(inps.CommitMessage).toMatch('');
|
expect(inps.CommitMessage).toMatch('');
|
||||||
|
expect(inps.FullCommitMessage).toMatch('');
|
||||||
expect(inps.TagName).toMatch('');
|
expect(inps.TagName).toMatch('');
|
||||||
expect(inps.TagMessage).toMatch('');
|
expect(inps.TagMessage).toMatch('');
|
||||||
|
expect(inps.DisableNoJekyll).toBe(false);
|
||||||
|
expect(inps.CNAME).toMatch('');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('get spec inputs', () => {
|
test('get spec inputs', () => {
|
||||||
@@ -71,8 +134,11 @@ describe('getInputs()', () => {
|
|||||||
process.env['INPUT_USER_NAME'] = 'username';
|
process.env['INPUT_USER_NAME'] = 'username';
|
||||||
process.env['INPUT_USER_EMAIL'] = 'github@github.com';
|
process.env['INPUT_USER_EMAIL'] = 'github@github.com';
|
||||||
process.env['INPUT_COMMIT_MESSAGE'] = 'feat: Add new feature';
|
process.env['INPUT_COMMIT_MESSAGE'] = 'feat: Add new feature';
|
||||||
|
process.env['INPUT_FULL_COMMIT_MESSAGE'] = 'feat: Add new feature';
|
||||||
process.env['INPUT_TAG_NAME'] = 'deploy-v1.2.3';
|
process.env['INPUT_TAG_NAME'] = 'deploy-v1.2.3';
|
||||||
process.env['INPUT_TAG_MESSAGE'] = 'Deployment v1.2.3';
|
process.env['INPUT_TAG_MESSAGE'] = 'Deployment v1.2.3';
|
||||||
|
process.env['INPUT_DISABLE_NOJEKYLL'] = 'true';
|
||||||
|
process.env['INPUT_CNAME'] = 'github.com';
|
||||||
|
|
||||||
const inps: Inputs = getInputs();
|
const inps: Inputs = getInputs();
|
||||||
|
|
||||||
@@ -88,7 +154,26 @@ describe('getInputs()', () => {
|
|||||||
expect(inps.UserName).toMatch('username');
|
expect(inps.UserName).toMatch('username');
|
||||||
expect(inps.UserEmail).toMatch('github@github.com');
|
expect(inps.UserEmail).toMatch('github@github.com');
|
||||||
expect(inps.CommitMessage).toMatch('feat: Add new feature');
|
expect(inps.CommitMessage).toMatch('feat: Add new feature');
|
||||||
|
expect(inps.FullCommitMessage).toMatch('feat: Add new feature');
|
||||||
expect(inps.TagName).toMatch('deploy-v1.2.3');
|
expect(inps.TagName).toMatch('deploy-v1.2.3');
|
||||||
expect(inps.TagMessage).toMatch('Deployment v1.2.3');
|
expect(inps.TagMessage).toMatch('Deployment v1.2.3');
|
||||||
|
expect(inps.DisableNoJekyll).toBe(true);
|
||||||
|
expect(inps.CNAME).toMatch('github.com');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get spec inputs enable_jekyll', () => {
|
||||||
|
process.env['INPUT_ENABLE_JEKYLL'] = 'true';
|
||||||
|
const inps: Inputs = getInputs();
|
||||||
|
expect(inps.DisableNoJekyll).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('throw error enable_jekyll or disable_nojekyll', () => {
|
||||||
|
process.env['INPUT_DEPLOY_KEY'] = 'test_deploy_key';
|
||||||
|
process.env['INPUT_ENABLE_JEKYLL'] = 'true';
|
||||||
|
process.env['INPUT_DISABLE_NOJEKYLL'] = 'true';
|
||||||
|
|
||||||
|
expect(() => {
|
||||||
|
getInputs();
|
||||||
|
}).toThrowError('Use either of enable_jekyll or disable_nojekyll');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
166
__tests__/git-utils.test.ts
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
import {getUserName, getUserEmail, setCommitAuthor, getCommitMessage} from '../src/git-utils';
|
||||||
|
import {getWorkDirName, createWorkDir} from '../src/utils';
|
||||||
|
import {CmdResult} from '../src/interfaces';
|
||||||
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.resetModules();
|
||||||
|
process.env['GITHUB_ACTOR'] = 'default-octocat';
|
||||||
|
process.env['GITHUB_REPOSITORY'] = 'owner/repo';
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
delete process.env['GITHUB_ACTOR'];
|
||||||
|
delete process.env['GITHUB_REPOSITORY'];
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getUserName()', () => {
|
||||||
|
test('get default git user name', () => {
|
||||||
|
const userName = '';
|
||||||
|
const test = getUserName(userName);
|
||||||
|
expect(test).toMatch('default-octocat');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get custom git user name', () => {
|
||||||
|
const userName = 'custom-octocat';
|
||||||
|
const test = getUserName(userName);
|
||||||
|
expect(test).toMatch(userName);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getUserEmail()', () => {
|
||||||
|
test('get default git user email', () => {
|
||||||
|
const userEmail = '';
|
||||||
|
const test = getUserEmail(userEmail);
|
||||||
|
expect(test).toMatch('default-octocat@users.noreply.github.com');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get custom git user email', () => {
|
||||||
|
const userEmail = 'custom-octocat@github.com';
|
||||||
|
const test = getUserEmail(userEmail);
|
||||||
|
expect(test).toMatch(userEmail);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('setCommitAuthor()', () => {
|
||||||
|
let workDirName = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
const date = new Date();
|
||||||
|
const unixTime = date.getTime();
|
||||||
|
workDirName = await getWorkDirName(`${unixTime}`);
|
||||||
|
})();
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await createWorkDir(workDirName);
|
||||||
|
process.chdir(workDirName);
|
||||||
|
await exec.exec('git', ['init']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get default commit author', async () => {
|
||||||
|
const userName = '';
|
||||||
|
const userEmail = '';
|
||||||
|
const result: CmdResult = {
|
||||||
|
exitcode: 0,
|
||||||
|
output: ''
|
||||||
|
};
|
||||||
|
const options = {
|
||||||
|
listeners: {
|
||||||
|
stdout: (data: Buffer): void => {
|
||||||
|
result.output += data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
await setCommitAuthor(userName, userEmail);
|
||||||
|
result.exitcode = await exec.exec('git', ['config', 'user.name'], options);
|
||||||
|
expect(result.output).toMatch('default-octocat');
|
||||||
|
result.exitcode = await exec.exec('git', ['config', 'user.email'], options);
|
||||||
|
expect(result.output).toMatch('default-octocat@users.noreply.github.com');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get custom commit author', async () => {
|
||||||
|
const userName = 'custom-octocat';
|
||||||
|
const userEmail = 'custom-octocat@github.com';
|
||||||
|
const result: CmdResult = {
|
||||||
|
exitcode: 0,
|
||||||
|
output: ''
|
||||||
|
};
|
||||||
|
const options = {
|
||||||
|
listeners: {
|
||||||
|
stdout: (data: Buffer): void => {
|
||||||
|
result.output += data.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
await setCommitAuthor(userName, userEmail);
|
||||||
|
result.exitcode = await exec.exec('git', ['config', 'user.name'], options);
|
||||||
|
expect(result.output).toMatch(userName);
|
||||||
|
result.exitcode = await exec.exec('git', ['config', 'user.email'], options);
|
||||||
|
expect(result.output).toMatch(userEmail);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('throw error user_email is undefined', async () => {
|
||||||
|
const userName = 'custom-octocat';
|
||||||
|
const userEmail = '';
|
||||||
|
await expect(setCommitAuthor(userName, userEmail)).rejects.toThrowError(
|
||||||
|
'user_email is undefined'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('throw error user_name is undefined', async () => {
|
||||||
|
const userName = '';
|
||||||
|
const userEmail = 'custom-octocat@github.com';
|
||||||
|
await expect(setCommitAuthor(userName, userEmail)).rejects.toThrowError(
|
||||||
|
'user_name is undefined'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getCommitMessage()', () => {
|
||||||
|
test('get default message', () => {
|
||||||
|
const test = getCommitMessage('', '', '', 'actions/pages', 'commit_hash');
|
||||||
|
expect(test).toMatch('deploy: commit_hash');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get default message for external repository', () => {
|
||||||
|
const test = getCommitMessage(
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'actions/actions.github.io',
|
||||||
|
'actions/pages',
|
||||||
|
'commit_hash'
|
||||||
|
);
|
||||||
|
expect(test).toMatch('deploy: actions/pages@commit_hash');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get custom message', () => {
|
||||||
|
const test = getCommitMessage('Custom msg', '', '', 'actions/pages', 'commit_hash');
|
||||||
|
expect(test).toMatch('Custom msg commit_hash');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get custom message for external repository', () => {
|
||||||
|
const test = getCommitMessage(
|
||||||
|
'Custom msg',
|
||||||
|
'',
|
||||||
|
'actions/actions.github.io',
|
||||||
|
'actions/pages',
|
||||||
|
'commit_hash'
|
||||||
|
);
|
||||||
|
expect(test).toMatch('Custom msg actions/pages@commit_hash');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get full custom message', () => {
|
||||||
|
const test = getCommitMessage('', 'Full custom msg', '', 'actions/pages', 'commit_hash');
|
||||||
|
expect(test).toMatch('Full custom msg');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get full custom message for external repository', () => {
|
||||||
|
const test = getCommitMessage(
|
||||||
|
'',
|
||||||
|
'Full custom msg',
|
||||||
|
'actions/actions.github.io',
|
||||||
|
'actions/pages',
|
||||||
|
'commit_hash'
|
||||||
|
);
|
||||||
|
expect(test).toMatch('Full custom msg');
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
// import {run} from '../src/main';
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
jest.resetModules();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
delete process.env['INPUT_DEPLOY_KEY'];
|
|
||||||
delete process.env['INPUT_GITHUB_TOKEN'];
|
|
||||||
delete process.env['INPUT_PERSONAL_TOKEN'];
|
|
||||||
delete process.env['INPUT_PUBLISH_BRANCH'];
|
|
||||||
delete process.env['INPUT_PUBLISH_DIR'];
|
|
||||||
delete process.env['INPUT_EXTERNAL_REPOSITORY'];
|
|
||||||
delete process.env['INPUT_ALLOW_EMPTY_COMMIT'];
|
|
||||||
delete process.env['INPUT_KEEP_FILES'];
|
|
||||||
delete process.env['INPUT_FORCE_ORPHAN'];
|
|
||||||
delete process.env['INPUT_USER_NAME'];
|
|
||||||
delete process.env['INPUT_USER_EMAIL'];
|
|
||||||
delete process.env['INPUT_COMMIT_MESSAGE'];
|
|
||||||
delete process.env['INPUT_TAG_NAME'];
|
|
||||||
delete process.env['INPUT_TAG_MESSAGE'];
|
|
||||||
delete process.env['INPUT_TAG_OVERWRITE'];
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Integration testing run()', () => {
|
|
||||||
test('succeed in pushing using deploy key', async () => {
|
|
||||||
// process.env['INPUT_DEPLOY_KEY'] = 'test_deploy_key';
|
|
||||||
// process.env['GITHUB_REPOSITORY'] = 'owner/repo';
|
|
||||||
// const exitcode = await run();
|
|
||||||
expect(0).toBe(0);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
92
__tests__/set-tokens.test.ts
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
import {getPublishRepo, setPersonalToken, setGithubToken} from '../src/set-tokens';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.resetModules();
|
||||||
|
});
|
||||||
|
|
||||||
|
// afterEach(() => {
|
||||||
|
|
||||||
|
// });
|
||||||
|
|
||||||
|
describe('getPublishRepo()', () => {
|
||||||
|
test('return repository name', () => {
|
||||||
|
const test = getPublishRepo('', 'owner', 'repo');
|
||||||
|
expect(test).toMatch('owner/repo');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('return external repository name', () => {
|
||||||
|
const test = getPublishRepo('extOwner/extRepo', 'owner', 'repo');
|
||||||
|
expect(test).toMatch('extOwner/extRepo');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('setGithubToken()', () => {
|
||||||
|
test('return remote url with GITHUB_TOKEN gh-pages', () => {
|
||||||
|
const expected = 'https://x-access-token:GITHUB_TOKEN@github.com/owner/repo.git';
|
||||||
|
const test = setGithubToken(
|
||||||
|
'GITHUB_TOKEN',
|
||||||
|
'owner/repo',
|
||||||
|
'gh-pages',
|
||||||
|
'',
|
||||||
|
'refs/heads/master',
|
||||||
|
'push'
|
||||||
|
);
|
||||||
|
expect(test).toMatch(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('return remote url with GITHUB_TOKEN master', () => {
|
||||||
|
const expected = 'https://x-access-token:GITHUB_TOKEN@github.com/owner/repo.git';
|
||||||
|
const test = setGithubToken(
|
||||||
|
'GITHUB_TOKEN',
|
||||||
|
'owner/repo',
|
||||||
|
'master',
|
||||||
|
'',
|
||||||
|
'refs/heads/source',
|
||||||
|
'push'
|
||||||
|
);
|
||||||
|
expect(test).toMatch(expected);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('throw error master to master', () => {
|
||||||
|
expect(() => {
|
||||||
|
setGithubToken('GITHUB_TOKEN', 'owner/repo', 'master', '', 'refs/heads/master', 'push');
|
||||||
|
}).toThrowError('You deploy from master to master');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('throw error external repository with GITHUB_TOKEN', () => {
|
||||||
|
expect(() => {
|
||||||
|
setGithubToken(
|
||||||
|
'GITHUB_TOKEN',
|
||||||
|
'owner/repo',
|
||||||
|
'gh-pages',
|
||||||
|
'extOwner/extRepo',
|
||||||
|
'refs/heads/master',
|
||||||
|
'push'
|
||||||
|
);
|
||||||
|
}).toThrowError(`\
|
||||||
|
The generated GITHUB_TOKEN (github_token) does not support to push to an external repository.
|
||||||
|
Use deploy_key or personal_token.
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('return remote url with GITHUB_TOKEN pull_request', () => {
|
||||||
|
const expected = 'https://x-access-token:GITHUB_TOKEN@github.com/owner/repo.git';
|
||||||
|
const test = setGithubToken(
|
||||||
|
'GITHUB_TOKEN',
|
||||||
|
'owner/repo',
|
||||||
|
'gh-pages',
|
||||||
|
'',
|
||||||
|
'refs/pull/29/merge',
|
||||||
|
'pull_request'
|
||||||
|
);
|
||||||
|
expect(test).toMatch(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('setPersonalToken()', () => {
|
||||||
|
test('return remote url with personal access token', () => {
|
||||||
|
const expected = 'https://x-access-token:pat@github.com/owner/repo.git';
|
||||||
|
const test = setPersonalToken('pat', 'owner/repo');
|
||||||
|
expect(test).toMatch(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
233
__tests__/utils.test.ts
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
import path from 'path';
|
||||||
|
import fs from 'fs';
|
||||||
|
import {
|
||||||
|
getHomeDir,
|
||||||
|
getWorkDirName,
|
||||||
|
createWorkDir,
|
||||||
|
addNoJekyll,
|
||||||
|
addCNAME,
|
||||||
|
skipOnFork
|
||||||
|
} from '../src/utils';
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jest.resetModules();
|
||||||
|
});
|
||||||
|
|
||||||
|
// afterEach(() => {
|
||||||
|
|
||||||
|
// });
|
||||||
|
|
||||||
|
async function getTime(): Promise<string> {
|
||||||
|
const date = new Date();
|
||||||
|
const unixTime = date.getTime();
|
||||||
|
return `${unixTime}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('getHomeDir()', () => {
|
||||||
|
test('get home directory name', async () => {
|
||||||
|
let test = '';
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
test = 'C:\\Users\\runneradmin';
|
||||||
|
} else {
|
||||||
|
test = `${process.env.HOME}`;
|
||||||
|
}
|
||||||
|
const expected = await getHomeDir();
|
||||||
|
expect(test).toMatch(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getWorkDirName()', () => {
|
||||||
|
test('get work directory name', async () => {
|
||||||
|
let home = '';
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
home = 'C:\\Users\\runneradmin';
|
||||||
|
} else {
|
||||||
|
home = `${process.env.HOME}`;
|
||||||
|
}
|
||||||
|
const unixTime = await getTime();
|
||||||
|
const expected = path.join(home, `actions_github_pages_${unixTime}`);
|
||||||
|
const test = await getWorkDirName(`${unixTime}`);
|
||||||
|
expect(test).toMatch(expected);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('createWorkDir()', () => {
|
||||||
|
test('create work directory', async () => {
|
||||||
|
const unixTime = await getTime();
|
||||||
|
const workDirName = await getWorkDirName(`${unixTime}`);
|
||||||
|
await createWorkDir(workDirName);
|
||||||
|
const test = fs.existsSync(workDirName);
|
||||||
|
expect(test).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
async function getWorkDir(): Promise<string> {
|
||||||
|
const unixTime = await getTime();
|
||||||
|
let workDir = '';
|
||||||
|
workDir = await getWorkDirName(`${unixTime}`);
|
||||||
|
await createWorkDir(workDir);
|
||||||
|
return workDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('addNoJekyll()', () => {
|
||||||
|
test('add .nojekyll gh-pages', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
|
await addNoJekyll(workDir, false, 'gh-pages');
|
||||||
|
const test = fs.existsSync(filepath);
|
||||||
|
expect(test).toBe(true);
|
||||||
|
|
||||||
|
fs.unlinkSync(filepath);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('add .nojekyll master', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
|
await addNoJekyll(workDir, false, 'master');
|
||||||
|
const test = fs.existsSync(filepath);
|
||||||
|
expect(test).toBe(true);
|
||||||
|
|
||||||
|
fs.unlinkSync(filepath);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('.nojekyll already exists', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
fs.closeSync(fs.openSync(filepath, 'w'));
|
||||||
|
|
||||||
|
await addNoJekyll(workDir, false, 'master');
|
||||||
|
const test = fs.existsSync(filepath);
|
||||||
|
expect(test).toBe(true);
|
||||||
|
|
||||||
|
fs.unlinkSync(filepath);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('not add .nojekyll disable_nojekyll gh-pages', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
|
await addNoJekyll(workDir, true, 'gh-pages');
|
||||||
|
const test = fs.existsSync(filepath);
|
||||||
|
expect(test).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('not add .nojekyll disable_nojekyll master', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
|
await addNoJekyll(workDir, true, 'master');
|
||||||
|
const test = fs.existsSync(filepath);
|
||||||
|
expect(test).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('not add .nojekyll other-branch', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
|
await addNoJekyll(workDir, false, 'other-branch');
|
||||||
|
const test = fs.existsSync(filepath);
|
||||||
|
expect(test).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('not add .nojekyll disable_nojekyll other-branch', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
|
await addNoJekyll(workDir, true, 'other-branch');
|
||||||
|
const test = fs.existsSync(filepath);
|
||||||
|
expect(test).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('addCNAME()', () => {
|
||||||
|
test('add CNAME', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, 'CNAME');
|
||||||
|
|
||||||
|
await addCNAME(workDir, 'github.com');
|
||||||
|
const test = fs.readFileSync(filepath, 'utf8');
|
||||||
|
expect(test).toMatch('github.com');
|
||||||
|
|
||||||
|
fs.unlinkSync(filepath);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('do nothing', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, 'CNAME');
|
||||||
|
|
||||||
|
await addCNAME(workDir, '');
|
||||||
|
const test = fs.existsSync(filepath);
|
||||||
|
expect(test).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('CNAME already exists', async () => {
|
||||||
|
let workDir = '';
|
||||||
|
(async (): Promise<void> => {
|
||||||
|
workDir = await getWorkDir();
|
||||||
|
})();
|
||||||
|
const filepath = path.join(workDir, 'CNAME');
|
||||||
|
|
||||||
|
await addCNAME(workDir, 'github.io');
|
||||||
|
await addCNAME(workDir, 'github.com');
|
||||||
|
const test = fs.readFileSync(filepath, 'utf8');
|
||||||
|
expect(test).toMatch('github.io');
|
||||||
|
|
||||||
|
fs.unlinkSync(filepath);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('skipOnFork()', () => {
|
||||||
|
test('return false on upstream', async () => {
|
||||||
|
const test = await skipOnFork(false, 'token', '', '');
|
||||||
|
expect(test).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('return false on fork with github_token', async () => {
|
||||||
|
const test = await skipOnFork(true, 'token', '', '');
|
||||||
|
expect(test).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('return false on fork with deploy_key', async () => {
|
||||||
|
const test = await skipOnFork(true, '', 'deploy_key', '');
|
||||||
|
expect(test).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('return false on fork with personal_token', async () => {
|
||||||
|
const test = await skipOnFork(true, '', '', 'personal_token');
|
||||||
|
expect(test).toBeFalsy();
|
||||||
|
});
|
||||||
|
|
||||||
|
test('return true on fork with no tokens', async () => {
|
||||||
|
const test = await skipOnFork(true, '', '', '');
|
||||||
|
expect(test).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
30
action.yml
@@ -1,4 +1,4 @@
|
|||||||
name: 'GitHub Pages v3'
|
name: 'GitHub Pages action'
|
||||||
description: 'GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.'
|
description: 'GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.'
|
||||||
author: 'peaceiris'
|
author: 'peaceiris'
|
||||||
runs:
|
runs:
|
||||||
@@ -9,24 +9,24 @@ branding:
|
|||||||
color: 'blue'
|
color: 'blue'
|
||||||
inputs:
|
inputs:
|
||||||
deploy_key:
|
deploy_key:
|
||||||
description: ''
|
description: 'Set a SSH private key from repository secret value for pushing to the remote branch.'
|
||||||
required: false
|
required: false
|
||||||
github_token:
|
github_token:
|
||||||
description: ''
|
description: 'Set a generated GITHUB_TOKEN for pushing to the remote branch.'
|
||||||
required: false
|
required: false
|
||||||
personal_token:
|
personal_token:
|
||||||
description: ''
|
description: 'Set a personal access token for pushing to the remote branch.'
|
||||||
required: false
|
required: false
|
||||||
publish_branch:
|
publish_branch:
|
||||||
description: ''
|
description: 'Set a target branch for deployment.'
|
||||||
required: false
|
required: false
|
||||||
default: 'gh-pages'
|
default: 'gh-pages'
|
||||||
publish_dir:
|
publish_dir:
|
||||||
description: ''
|
description: 'Set an input directory for deployment.'
|
||||||
required: false
|
required: false
|
||||||
default: 'public'
|
default: 'public'
|
||||||
external_repository:
|
external_repository:
|
||||||
description: ''
|
description: 'Set an external repository (owner/repo).'
|
||||||
required: false
|
required: false
|
||||||
allow_empty_commit:
|
allow_empty_commit:
|
||||||
description: 'If empty commits should be made to the publication branch'
|
description: 'If empty commits should be made to the publication branch'
|
||||||
@@ -47,7 +47,10 @@ inputs:
|
|||||||
description: 'Set Git user.email'
|
description: 'Set Git user.email'
|
||||||
required: false
|
required: false
|
||||||
commit_message:
|
commit_message:
|
||||||
description: 'Set custom commit message'
|
description: 'Set a custom commit message with a triggered commit hash'
|
||||||
|
required: false
|
||||||
|
full_commit_message:
|
||||||
|
description: 'Set a custom full commit message without a triggered commit hash'
|
||||||
required: false
|
required: false
|
||||||
tag_name:
|
tag_name:
|
||||||
description: 'Set tag name'
|
description: 'Set tag name'
|
||||||
@@ -55,3 +58,14 @@ inputs:
|
|||||||
tag_message:
|
tag_message:
|
||||||
description: 'Set tag message'
|
description: 'Set tag message'
|
||||||
required: false
|
required: false
|
||||||
|
enable_jekyll:
|
||||||
|
description: 'Enable the GitHub Pages built-in Jekyll'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
disable_nojekyll:
|
||||||
|
description: 'An alias for enable_jekyll to disable adding .nojekyll file to master or gh-pages branches'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
|
cname:
|
||||||
|
description: 'Set custom domain'
|
||||||
|
required: false
|
||||||
|
|||||||
BIN
images/commit_message.jpg
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
images/committer_github_actions_bot.jpg
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
images/log1.jpg
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 78 KiB |
BIN
images/log2.jpg
|
Before Width: | Height: | Size: 64 KiB |
BIN
images/log3.jpg
|
Before Width: | Height: | Size: 151 KiB |
BIN
images/log_first_deployment_failed_with_github_token.jpg
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
images/log_overview.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
images/log_success.jpg
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
images/settings_inactive.jpg
Normal file
|
After Width: | Height: | Size: 58 KiB |
BIN
images/settings_select.jpg
Normal file
|
After Width: | Height: | Size: 79 KiB |
@@ -8,4 +8,4 @@ module.exports = {
|
|||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': 'ts-jest'
|
||||||
},
|
},
|
||||||
verbose: true
|
verbose: true
|
||||||
}
|
};
|
||||||
|
|||||||
29000
lib/index.js
4659
package-lock.json
generated
53
package.json
@@ -1,17 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "actions-github-pages",
|
"name": "actions-github-pages",
|
||||||
"version": "3.0.0-1",
|
"version": "3.6.2",
|
||||||
"description": "GitHub Actions for GitHub Pages",
|
"description": "GitHub Actions for GitHub Pages",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12.14.1",
|
"node": ">=12.16.3",
|
||||||
"npm": ">=6.13.7"
|
"npm": ">=6.14.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"all": "npm run format && npm run lint && npm test",
|
||||||
"lint": "eslint ./{src,__tests__}/**/*.ts",
|
"lint": "eslint ./{src,__tests__}/**/*.ts",
|
||||||
"lint:fix": "eslint --fix ./{src,__tests__}/**/*.ts",
|
"lint:fix": "eslint --fix ./{src,__tests__}/**/*.ts",
|
||||||
"test": "jest --coverage --verbose --detectOpenHandles",
|
"test": "jest --coverage --verbose --detectOpenHandles",
|
||||||
"build": "ncc build ./src/index.ts -o lib",
|
"build": "ncc build ./src/index.ts -o lib --minify",
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
"format:check": "prettier --check **/*.ts",
|
"format:check": "prettier --check **/*.ts",
|
||||||
@@ -26,9 +27,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"src/**/*.ts": [
|
"{src,__tests__}/**/*.ts": [
|
||||||
"prettier --check",
|
"prettier --check",
|
||||||
"eslint"
|
"eslint"
|
||||||
|
],
|
||||||
|
"README.md": [
|
||||||
|
"npx doctoc@1.4.0 --github"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -50,27 +54,30 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/peaceiris/actions-gh-pages#readme",
|
"homepage": "https://github.com/peaceiris/actions-gh-pages#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.2",
|
"@actions/core": "^1.2.4",
|
||||||
"@actions/exec": "^1.0.3",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/github": "^2.1.0",
|
"@actions/github": "^4.0.0",
|
||||||
"@actions/glob": "^0.1.0",
|
|
||||||
"@actions/io": "^1.0.2"
|
"@actions/io": "^1.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^25.1.1",
|
"@types/jest": "^26.0.4",
|
||||||
"@types/node": "^13.7.0",
|
"@types/js-yaml": "^3.12.4",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.19.0",
|
"@types/node": "~12",
|
||||||
"@typescript-eslint/parser": "^2.19.0",
|
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
||||||
"@zeit/ncc": "^0.21.0",
|
"@typescript-eslint/parser": "^2.34.0",
|
||||||
|
"@zeit/ncc": "^0.22.3",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-jest": "^23.6.0",
|
"eslint-config-prettier": "^6.11.0",
|
||||||
"husky": "^4.2.1",
|
"eslint-plugin-jest": "^23.18.0",
|
||||||
"jest": "^25.1.0",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"jest-circus": "^25.1.0",
|
"husky": "^4.2.5",
|
||||||
"lint-staged": "^10.0.7",
|
"jest": "^25.5.4",
|
||||||
"prettier": "1.19.1",
|
"jest-circus": "^26.1.0",
|
||||||
"standard-version": "^7.1.0",
|
"js-yaml": "^3.14.0",
|
||||||
"ts-jest": "^25.2.0",
|
"lint-staged": "^10.2.11",
|
||||||
"typescript": "^3.7.5"
|
"prettier": "2.0.5",
|
||||||
|
"standard-version": "^8.0.0",
|
||||||
|
"ts-jest": "^25.5.1",
|
||||||
|
"typescript": "^3.9.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
release.sh
@@ -3,12 +3,23 @@
|
|||||||
# fail on unset variables and command errors
|
# fail on unset variables and command errors
|
||||||
set -eu -o pipefail # -x: is for debugging
|
set -eu -o pipefail # -x: is for debugging
|
||||||
|
|
||||||
if [ "$(git branch --show-current)" != "master" ]; then
|
CURRENT_BRANCH="$(git branch --show-current)"
|
||||||
echo "$0: Current branch is not master" 1>&2
|
if [ "${CURRENT_BRANCH}" != "master" ]; then
|
||||||
exit 1
|
echo "$0: Current branch ${CURRENT_BRANCH} is not master, continue? (y/n)"
|
||||||
|
read -r res
|
||||||
|
if [ "${res}" = "n" ]; then
|
||||||
|
echo "$0: Stop script"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
PRERELEASE_TYPE_LIST="prerelease prepatch preminor premajor"
|
||||||
|
if [ "${CURRENT_BRANCH}" != "master" ]; then
|
||||||
|
RELEASE_TYPE_LIST="${PRERELEASE_TYPE_LIST}"
|
||||||
|
else
|
||||||
|
RELEASE_TYPE_LIST="${PRERELEASE_TYPE_LIST} patch minor major"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RELEASE_TYPE_LIST="prerelease prepatch patch preminor minor major premajor"
|
|
||||||
if command -v fzf; then
|
if command -v fzf; then
|
||||||
RELEASE_TYPE=$(echo "${RELEASE_TYPE_LIST}" | tr ' ' '\n' | fzf --layout=reverse)
|
RELEASE_TYPE=$(echo "${RELEASE_TYPE_LIST}" | tr ' ' '\n' | fzf --layout=reverse)
|
||||||
else
|
else
|
||||||
@@ -26,9 +37,13 @@ if [ "${res}" = "n" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
git fetch origin
|
git fetch origin
|
||||||
git pull origin master
|
if [ "${CURRENT_BRANCH}" != "master" ]; then
|
||||||
git tag -d v3 || true
|
git pull origin "${CURRENT_BRANCH}"
|
||||||
git pull origin --tags
|
else
|
||||||
|
git pull origin master
|
||||||
|
git tag -d v3 || true
|
||||||
|
git pull origin --tags
|
||||||
|
fi
|
||||||
|
|
||||||
npm ci
|
npm ci
|
||||||
|
|
||||||
@@ -43,6 +58,11 @@ git rm ./lib/index.js
|
|||||||
rm -rf ./lib
|
rm -rf ./lib
|
||||||
git commit -m "chore(release): Remove build assets [skip ci]"
|
git commit -m "chore(release): Remove build assets [skip ci]"
|
||||||
|
|
||||||
|
if [ "${CURRENT_BRANCH}" != "master" ]; then
|
||||||
|
git push origin "${CURRENT_BRANCH}"
|
||||||
|
else
|
||||||
|
git push origin master
|
||||||
|
fi
|
||||||
|
|
||||||
TAG_NAME="v$(jq -r '.version' ./package.json)"
|
TAG_NAME="v$(jq -r '.version' ./package.json)"
|
||||||
git push origin master
|
|
||||||
git push origin "${TAG_NAME}"
|
git push origin "${TAG_NAME}"
|
||||||
|
|||||||
@@ -1,29 +1,51 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {Inputs} from './interfaces';
|
import {Inputs} from './interfaces';
|
||||||
|
|
||||||
function showInputs(inps: Inputs): void {
|
export function showInputs(inps: Inputs): void {
|
||||||
|
let authMethod = '';
|
||||||
if (inps.DeployKey) {
|
if (inps.DeployKey) {
|
||||||
core.info(`[INFO] DeployKey: true`);
|
authMethod = 'DeployKey';
|
||||||
} else if (inps.GithubToken) {
|
} else if (inps.GithubToken) {
|
||||||
core.info(`[INFO] GithubToken: true`);
|
authMethod = 'GithubToken';
|
||||||
} else if (inps.PersonalToken) {
|
} else if (inps.PersonalToken) {
|
||||||
core.info(`[INFO] PersonalToken: true`);
|
authMethod = 'PersonalToken';
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`[INFO] PublishBranch: ${inps.PublishBranch}`);
|
core.info(`\
|
||||||
core.info(`[INFO] PublishDir: ${inps.PublishDir}`);
|
[INFO] ${authMethod}: true
|
||||||
core.info(`[INFO] ExternalRepository: ${inps.ExternalRepository}`);
|
[INFO] PublishBranch: ${inps.PublishBranch}
|
||||||
core.info(`[INFO] AllowEmptyCommit: ${inps.AllowEmptyCommit}`);
|
[INFO] PublishDir: ${inps.PublishDir}
|
||||||
core.info(`[INFO] KeepFiles: ${inps.KeepFiles}`);
|
[INFO] ExternalRepository: ${inps.ExternalRepository}
|
||||||
core.info(`[INFO] ForceOrphan: ${inps.ForceOrphan}`);
|
[INFO] AllowEmptyCommit: ${inps.AllowEmptyCommit}
|
||||||
core.info(`[INFO] UserEmail: ${inps.UserEmail}`);
|
[INFO] KeepFiles: ${inps.KeepFiles}
|
||||||
core.info(`[INFO] UserEmail: ${inps.UserEmail}`);
|
[INFO] ForceOrphan: ${inps.ForceOrphan}
|
||||||
core.info(`[INFO] CommitMessage: ${inps.CommitMessage}`);
|
[INFO] UserName: ${inps.UserName}
|
||||||
core.info(`[INFO] TagName: ${inps.TagName}`);
|
[INFO] UserEmail: ${inps.UserEmail}
|
||||||
core.info(`[INFO] TagMessage: ${inps.TagMessage}`);
|
[INFO] CommitMessage: ${inps.CommitMessage}
|
||||||
|
[INFO] FullCommitMessage: ${inps.FullCommitMessage}
|
||||||
|
[INFO] TagName: ${inps.TagName}
|
||||||
|
[INFO] TagMessage: ${inps.TagMessage}
|
||||||
|
[INFO] EnableJekyll (DisableNoJekyll): ${inps.DisableNoJekyll}
|
||||||
|
[INFO] CNAME: ${inps.CNAME}
|
||||||
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
|
let useBuiltinJekyll = false;
|
||||||
|
|
||||||
|
const enableJekyll: boolean =
|
||||||
|
(core.getInput('enable_jekyll') || 'false').toUpperCase() === 'TRUE';
|
||||||
|
const disableNoJekyll: boolean =
|
||||||
|
(core.getInput('disable_nojekyll') || 'false').toUpperCase() === 'TRUE';
|
||||||
|
|
||||||
|
if (enableJekyll && disableNoJekyll) {
|
||||||
|
throw new Error(`Use either of enable_jekyll or disable_nojekyll`);
|
||||||
|
} else if (enableJekyll) {
|
||||||
|
useBuiltinJekyll = true;
|
||||||
|
} else if (disableNoJekyll) {
|
||||||
|
useBuiltinJekyll = true;
|
||||||
|
}
|
||||||
|
|
||||||
const inps: Inputs = {
|
const inps: Inputs = {
|
||||||
DeployKey: core.getInput('deploy_key'),
|
DeployKey: core.getInput('deploy_key'),
|
||||||
GithubToken: core.getInput('github_token'),
|
GithubToken: core.getInput('github_token'),
|
||||||
@@ -31,20 +53,18 @@ export function getInputs(): Inputs {
|
|||||||
PublishBranch: core.getInput('publish_branch'),
|
PublishBranch: core.getInput('publish_branch'),
|
||||||
PublishDir: core.getInput('publish_dir'),
|
PublishDir: core.getInput('publish_dir'),
|
||||||
ExternalRepository: core.getInput('external_repository'),
|
ExternalRepository: core.getInput('external_repository'),
|
||||||
AllowEmptyCommit:
|
AllowEmptyCommit: (core.getInput('allow_empty_commit') || 'false').toUpperCase() === 'TRUE',
|
||||||
(core.getInput('allow_empty_commit') || 'false').toUpperCase() === 'TRUE',
|
KeepFiles: (core.getInput('keep_files') || 'false').toUpperCase() === 'TRUE',
|
||||||
KeepFiles:
|
ForceOrphan: (core.getInput('force_orphan') || 'false').toUpperCase() === 'TRUE',
|
||||||
(core.getInput('keep_files') || 'false').toUpperCase() === 'TRUE',
|
|
||||||
ForceOrphan:
|
|
||||||
(core.getInput('force_orphan') || 'false').toUpperCase() === 'TRUE',
|
|
||||||
UserName: core.getInput('user_name'),
|
UserName: core.getInput('user_name'),
|
||||||
UserEmail: core.getInput('user_email'),
|
UserEmail: core.getInput('user_email'),
|
||||||
CommitMessage: core.getInput('commit_message'),
|
CommitMessage: core.getInput('commit_message'),
|
||||||
|
FullCommitMessage: core.getInput('full_commit_message'),
|
||||||
TagName: core.getInput('tag_name'),
|
TagName: core.getInput('tag_name'),
|
||||||
TagMessage: core.getInput('tag_message')
|
TagMessage: core.getInput('tag_message'),
|
||||||
|
DisableNoJekyll: useBuiltinJekyll,
|
||||||
|
CNAME: core.getInput('cname')
|
||||||
};
|
};
|
||||||
|
|
||||||
showInputs(inps);
|
|
||||||
|
|
||||||
return inps;
|
return inps;
|
||||||
}
|
}
|
||||||
|
|||||||
176
src/git-utils.ts
@@ -1,17 +1,10 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as github from '@actions/github';
|
|
||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import * as glob from '@actions/glob';
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import fs from 'fs';
|
||||||
import {Inputs, CmdResult} from './interfaces';
|
import {Inputs, CmdResult} from './interfaces';
|
||||||
import {getHomeDir} from './utils';
|
import {createWorkDir} from './utils';
|
||||||
|
|
||||||
export async function createWorkDir(workDirName: string): Promise<void> {
|
|
||||||
await io.mkdirP(workDirName);
|
|
||||||
core.debug(`workDir was created: ${workDirName}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createBranchForce(branch: string): Promise<void> {
|
export async function createBranchForce(branch: string): Promise<void> {
|
||||||
await exec.exec('git', ['init']);
|
await exec.exec('git', ['init']);
|
||||||
@@ -19,29 +12,24 @@ export async function createBranchForce(branch: string): Promise<void> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function copyAssets(
|
export async function copyAssets(publishDir: string, workDir: string): Promise<void> {
|
||||||
publishDir: string,
|
const copyOpts = {recursive: true, force: true};
|
||||||
workDir: string
|
const files = fs.readdirSync(publishDir);
|
||||||
): Promise<void> {
|
core.debug(`${files}`);
|
||||||
const copyOpts = {recursive: true, force: false};
|
for await (const file of files) {
|
||||||
const globber = await glob.create(`${publishDir}/*`);
|
|
||||||
for await (const file of globber.globGenerator()) {
|
|
||||||
if (file.endsWith('.git') || file.endsWith('.github')) {
|
if (file.endsWith('.git') || file.endsWith('.github')) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
await io.cp(file, `${workDir}/`, copyOpts);
|
const filePath = path.join(publishDir, file);
|
||||||
|
await io.cp(filePath, `${workDir}/`, copyOpts);
|
||||||
core.info(`[INFO] copy ${file}`);
|
core.info(`[INFO] copy ${file}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
|
export async function setRepo(inps: Inputs, remoteURL: string, workDir: string): Promise<void> {
|
||||||
const workDir = path.join(getHomeDir(), 'actions_github_pages');
|
const publishDir = path.join(`${process.env.GITHUB_WORKSPACE}`, inps.PublishDir);
|
||||||
const publishDir = path.join(
|
|
||||||
`${process.env.GITHUB_WORKSPACE}`,
|
|
||||||
inps.PublishDir
|
|
||||||
);
|
|
||||||
|
|
||||||
core.info(`[INFO] ForceOrphan: ${inps.ForceOrphan}`);
|
core.info(`[INFO] ForceOrphan: ${inps.ForceOrphan}`);
|
||||||
if (inps.ForceOrphan) {
|
if (inps.ForceOrphan) {
|
||||||
@@ -63,87 +51,93 @@ export async function setRepo(inps: Inputs, remoteURL: string): Promise<void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
result.exitcode = await exec.exec(
|
|
||||||
'git',
|
|
||||||
[
|
|
||||||
'clone',
|
|
||||||
'--depth=1',
|
|
||||||
'--single-branch',
|
|
||||||
'--branch',
|
|
||||||
inps.PublishBranch,
|
|
||||||
remoteURL,
|
|
||||||
workDir
|
|
||||||
],
|
|
||||||
options
|
|
||||||
);
|
|
||||||
|
|
||||||
process.chdir(workDir);
|
try {
|
||||||
|
result.exitcode = await exec.exec(
|
||||||
if (result.exitcode === 0) {
|
'git',
|
||||||
if (inps.KeepFiles) {
|
['clone', '--depth=1', '--single-branch', '--branch', inps.PublishBranch, remoteURL, workDir],
|
||||||
core.info('[INFO] Keep existing files');
|
options
|
||||||
} else {
|
|
||||||
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
|
|
||||||
}
|
|
||||||
|
|
||||||
await copyAssets(publishDir, workDir);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
core.info(
|
|
||||||
`[INFO] first deployment, create new branch ${inps.PublishBranch}`
|
|
||||||
);
|
);
|
||||||
|
if (result.exitcode === 0) {
|
||||||
|
process.chdir(workDir);
|
||||||
|
if (inps.KeepFiles) {
|
||||||
|
core.info('[INFO] Keep existing files');
|
||||||
|
} else {
|
||||||
|
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
|
||||||
|
}
|
||||||
|
|
||||||
|
await copyAssets(publishDir, workDir);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
core.info(`[INFO] first deployment, create new branch ${inps.PublishBranch}`);
|
||||||
|
core.info(e.message);
|
||||||
await createWorkDir(workDir);
|
await createWorkDir(workDir);
|
||||||
|
process.chdir(workDir);
|
||||||
await createBranchForce(inps.PublishBranch);
|
await createBranchForce(inps.PublishBranch);
|
||||||
await copyAssets(publishDir, workDir);
|
await copyAssets(publishDir, workDir);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setConfig(
|
export function getUserName(userName: string): string {
|
||||||
userName: string,
|
|
||||||
userEmail: string
|
|
||||||
): Promise<void> {
|
|
||||||
await exec.exec('git', ['config', '--global', 'gc.auto', '0']);
|
|
||||||
|
|
||||||
let name = '';
|
|
||||||
if (userName) {
|
if (userName) {
|
||||||
name = userName;
|
return userName;
|
||||||
} else {
|
} else {
|
||||||
name = `${process.env.GITHUB_ACTOR}`;
|
return `${process.env.GITHUB_ACTOR}`;
|
||||||
}
|
}
|
||||||
await exec.exec('git', ['config', '--global', 'user.name', name]);
|
|
||||||
|
|
||||||
let email = '';
|
|
||||||
if (userName !== '' && userEmail !== '') {
|
|
||||||
email = userEmail;
|
|
||||||
} else {
|
|
||||||
email = `${process.env.GITHUB_ACTOR}@users.noreply.github.com`;
|
|
||||||
}
|
|
||||||
await exec.exec('git', ['config', '--global', 'user.email', email]);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function commit(
|
export function getUserEmail(userEmail: string): string {
|
||||||
allowEmptyCommit: boolean,
|
if (userEmail) {
|
||||||
externalRepository: string,
|
return userEmail;
|
||||||
message: string
|
|
||||||
): Promise<void> {
|
|
||||||
let msg = '';
|
|
||||||
if (message) {
|
|
||||||
msg = message;
|
|
||||||
} else {
|
} else {
|
||||||
msg = 'deploy:';
|
return `${process.env.GITHUB_ACTOR}@users.noreply.github.com`;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const hash = `${process.env.GITHUB_SHA}`;
|
export async function setCommitAuthor(userName: string, userEmail: string): Promise<void> {
|
||||||
const baseRepo = `${github.context.repo.owner}/${github.context.repo.repo}`;
|
if (userName && !userEmail) {
|
||||||
if (externalRepository) {
|
throw new Error('user_email is undefined');
|
||||||
msg = `${msg} ${baseRepo}@${hash}`;
|
|
||||||
} else {
|
|
||||||
msg = `${msg} ${hash}`;
|
|
||||||
}
|
}
|
||||||
|
if (!userName && userEmail) {
|
||||||
|
throw new Error('user_name is undefined');
|
||||||
|
}
|
||||||
|
await exec.exec('git', ['config', 'user.name', getUserName(userName)]);
|
||||||
|
await exec.exec('git', ['config', 'user.email', getUserEmail(userEmail)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCommitMessage(
|
||||||
|
msg: string,
|
||||||
|
fullMsg: string,
|
||||||
|
extRepo: string,
|
||||||
|
baseRepo: string,
|
||||||
|
hash: string
|
||||||
|
): string {
|
||||||
|
const msgHash = ((): string => {
|
||||||
|
if (extRepo) {
|
||||||
|
return `${baseRepo}@${hash}`;
|
||||||
|
} else {
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
const subject = ((): string => {
|
||||||
|
if (fullMsg) {
|
||||||
|
return fullMsg;
|
||||||
|
} else if (msg) {
|
||||||
|
return `${msg} ${msgHash}`;
|
||||||
|
} else {
|
||||||
|
return `deploy: ${msgHash}`;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
return subject;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function commit(allowEmptyCommit: boolean, msg: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (allowEmptyCommit) {
|
if (allowEmptyCommit) {
|
||||||
await exec.exec('git', ['commit', '--allow-empty', '-m', `${msg}`]);
|
await exec.exec('git', ['commit', '--allow-empty', '-m', `${msg}`]);
|
||||||
@@ -152,14 +146,11 @@ export async function commit(
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.info('[INFO] skip commit');
|
core.info('[INFO] skip commit');
|
||||||
core.debug(`[INFO] skip commit ${e}`);
|
core.debug(`[INFO] skip commit ${e.message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function push(
|
export async function push(branch: string, forceOrphan: boolean): Promise<void> {
|
||||||
branch: string,
|
|
||||||
forceOrphan: boolean
|
|
||||||
): Promise<void> {
|
|
||||||
if (forceOrphan) {
|
if (forceOrphan) {
|
||||||
await exec.exec('git', ['push', 'origin', '--force', branch]);
|
await exec.exec('git', ['push', 'origin', '--force', branch]);
|
||||||
} else {
|
} else {
|
||||||
@@ -167,10 +158,7 @@ export async function push(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function pushTag(
|
export async function pushTag(tagName: string, tagMessage: string): Promise<void> {
|
||||||
tagName: string,
|
|
||||||
tagMessage: string
|
|
||||||
): Promise<void> {
|
|
||||||
if (tagName === '') {
|
if (tagName === '') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ import * as main from './main';
|
|||||||
try {
|
try {
|
||||||
await main.run();
|
await main.run();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.setFailed(`Action failed with "${e}"`);
|
core.setFailed(`Action failed with "${e.message}"`);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ export interface Inputs {
|
|||||||
readonly UserName: string;
|
readonly UserName: string;
|
||||||
readonly UserEmail: string;
|
readonly UserEmail: string;
|
||||||
readonly CommitMessage: string;
|
readonly CommitMessage: string;
|
||||||
|
readonly FullCommitMessage: string;
|
||||||
readonly TagName: string;
|
readonly TagName: string;
|
||||||
readonly TagMessage: string;
|
readonly TagMessage: string;
|
||||||
|
readonly DisableNoJekyll: boolean;
|
||||||
|
readonly CNAME: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CmdResult {
|
export interface CmdResult {
|
||||||
|
|||||||
76
src/main.ts
@@ -1,40 +1,90 @@
|
|||||||
|
import {context} from '@actions/github';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
import * as github from '@actions/github';
|
||||||
import {Inputs} from './interfaces';
|
import {Inputs} from './interfaces';
|
||||||
import {getInputs} from './get-inputs';
|
import {showInputs, getInputs} from './get-inputs';
|
||||||
import {setTokens} from './set-tokens';
|
import {setTokens} from './set-tokens';
|
||||||
import * as git from './git-utils';
|
import {setRepo, setCommitAuthor, getCommitMessage, commit, push, pushTag} from './git-utils';
|
||||||
|
import {getWorkDirName, addNoJekyll, addCNAME, skipOnFork} from './utils';
|
||||||
|
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const inps: Inputs = getInputs();
|
const inps: Inputs = getInputs();
|
||||||
|
core.startGroup('Dump inputs');
|
||||||
|
showInputs(inps);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
await git.setConfig(inps.UserName, inps.UserEmail);
|
if (core.isDebug()) {
|
||||||
|
core.startGroup('Debug: dump context');
|
||||||
|
console.log(context);
|
||||||
|
core.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
const eventName = context.eventName;
|
||||||
|
if (eventName === 'pull_request' || eventName === 'push') {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const isForkRepository = (context.payload as any).repository.fork;
|
||||||
|
const isSkipOnFork = await skipOnFork(
|
||||||
|
isForkRepository,
|
||||||
|
inps.GithubToken,
|
||||||
|
inps.DeployKey,
|
||||||
|
inps.PersonalToken
|
||||||
|
);
|
||||||
|
if (isSkipOnFork) {
|
||||||
|
core.warning('This action runs on a fork and not found auth token, Skip deployment');
|
||||||
|
core.setOutput('skip', 'true');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.startGroup('Setup auth token');
|
||||||
const remoteURL = await setTokens(inps);
|
const remoteURL = await setTokens(inps);
|
||||||
core.info(`[INFO] remoteURL: ${remoteURL}`); // TODO: remove
|
core.debug(`remoteURL: ${remoteURL}`);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
await git.setRepo(inps, remoteURL);
|
core.startGroup('Prepare publishing assets');
|
||||||
|
const date = new Date();
|
||||||
|
const unixTime = date.getTime();
|
||||||
|
const workDir = await getWorkDirName(`${unixTime}`);
|
||||||
|
await setRepo(inps, remoteURL, workDir);
|
||||||
|
await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
|
||||||
|
await addCNAME(workDir, inps.CNAME);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
|
core.startGroup('Setup Git config');
|
||||||
try {
|
try {
|
||||||
await exec.exec('git', ['remote', 'rm', 'origin']);
|
await exec.exec('git', ['remote', 'rm', 'origin']);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
core.info(`[INFO] e`);
|
core.info(`[INFO] ${e.message}`);
|
||||||
}
|
}
|
||||||
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
|
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
|
||||||
await exec.exec('git', ['add', '--all']);
|
await exec.exec('git', ['add', '--all']);
|
||||||
|
await setCommitAuthor(inps.UserName, inps.UserEmail);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
await git.commit(
|
core.startGroup('Create a commit');
|
||||||
inps.AllowEmptyCommit,
|
const hash = `${process.env.GITHUB_SHA}`;
|
||||||
|
const baseRepo = `${github.context.repo.owner}/${github.context.repo.repo}`;
|
||||||
|
const commitMessage = getCommitMessage(
|
||||||
|
inps.CommitMessage,
|
||||||
|
inps.FullCommitMessage,
|
||||||
inps.ExternalRepository,
|
inps.ExternalRepository,
|
||||||
inps.CommitMessage
|
baseRepo,
|
||||||
|
hash
|
||||||
);
|
);
|
||||||
await git.push(inps.PublishBranch, inps.ForceOrphan);
|
await commit(inps.AllowEmptyCommit, commitMessage);
|
||||||
await git.pushTag(inps.TagName, inps.TagMessage);
|
core.endGroup();
|
||||||
core.info('[INFO] successfully deployed');
|
|
||||||
|
core.startGroup('Push the commit or tag');
|
||||||
|
await push(inps.PublishBranch, inps.ForceOrphan);
|
||||||
|
await pushTag(inps.TagName, inps.TagMessage);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
|
core.info('[INFO] Action successfully completed');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,23 +4,16 @@ import * as github from '@actions/github';
|
|||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
const cpSpawnSync = require('child_process').spawnSync;
|
||||||
const cpexec = require('child_process').execFileSync;
|
const cpexec = require('child_process').execFileSync;
|
||||||
import {Inputs} from './interfaces';
|
import {Inputs} from './interfaces';
|
||||||
|
import {getHomeDir} from './utils';
|
||||||
|
|
||||||
export function setPublishRepo(insp: Inputs): string {
|
export async function setSSHKey(inps: Inputs, publishRepo: string): Promise<string> {
|
||||||
if (insp.ExternalRepository) {
|
|
||||||
return insp.ExternalRepository;
|
|
||||||
}
|
|
||||||
return `${github.context.repo.owner}/${github.context.repo.repo}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function setSSHKey(
|
|
||||||
inps: Inputs,
|
|
||||||
publishRepo: string
|
|
||||||
): Promise<string> {
|
|
||||||
core.info('[INFO] setup SSH deploy key');
|
core.info('[INFO] setup SSH deploy key');
|
||||||
|
|
||||||
const sshDir = path.join(`${process.env.HOME}`, '.ssh');
|
const homeDir = await getHomeDir();
|
||||||
|
const sshDir = path.join(homeDir, '.ssh');
|
||||||
await io.mkdirP(sshDir);
|
await io.mkdirP(sshDir);
|
||||||
await exec.exec('chmod', ['700', sshDir]);
|
await exec.exec('chmod', ['700', sshDir]);
|
||||||
|
|
||||||
@@ -50,6 +43,17 @@ Host github
|
|||||||
core.info(`[INFO] wrote ${sshConfigPath}`);
|
core.info(`[INFO] wrote ${sshConfigPath}`);
|
||||||
await exec.exec('chmod', ['600', sshConfigPath]);
|
await exec.exec('chmod', ['600', sshConfigPath]);
|
||||||
|
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
core.warning(`\
|
||||||
|
Currently, the deploy_key option is not supported on the windows-latest.
|
||||||
|
Watch https://github.com/peaceiris/actions-gh-pages/issues/87
|
||||||
|
`);
|
||||||
|
|
||||||
|
await cpSpawnSync('Start-Process', ['powershell.exe', '-Verb', 'runas']);
|
||||||
|
await cpSpawnSync('sh', ['-c', '\'eval "$(ssh-agent)"\''], {shell: true});
|
||||||
|
await exec.exec('sc', ['config', 'ssh-agent', 'start=auto']);
|
||||||
|
await exec.exec('sc', ['start', 'ssh-agent']);
|
||||||
|
}
|
||||||
await cpexec('ssh-agent', ['-a', '/tmp/ssh-auth.sock']);
|
await cpexec('ssh-agent', ['-a', '/tmp/ssh-auth.sock']);
|
||||||
core.exportVariable('SSH_AUTH_SOCK', '/tmp/ssh-auth.sock');
|
core.exportVariable('SSH_AUTH_SOCK', '/tmp/ssh-auth.sock');
|
||||||
await exec.exec('ssh-add', [idRSA]);
|
await exec.exec('ssh-add', [idRSA]);
|
||||||
@@ -57,68 +61,76 @@ Host github
|
|||||||
return `git@github.com:${publishRepo}.git`;
|
return `git@github.com:${publishRepo}.git`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setGithubToken(
|
export function setGithubToken(
|
||||||
inps: Inputs,
|
githubToken: string,
|
||||||
publishRepo: string
|
publishRepo: string,
|
||||||
): Promise<string> {
|
publishBranch: string,
|
||||||
|
externalRepository: string,
|
||||||
|
ref: string,
|
||||||
|
eventName: string
|
||||||
|
): string {
|
||||||
core.info('[INFO] setup GITHUB_TOKEN');
|
core.info('[INFO] setup GITHUB_TOKEN');
|
||||||
|
|
||||||
const context = github.context;
|
core.debug(`ref: ${ref}`);
|
||||||
const payload = github.context.payload;
|
core.debug(`eventName: ${eventName}`);
|
||||||
core.debug(`ref: ${context.ref}`);
|
|
||||||
core.debug(`eventName: ${context.eventName}`);
|
|
||||||
core.debug(`private: ${payload.repository?.private}`);
|
|
||||||
let isProhibitedBranch = false;
|
let isProhibitedBranch = false;
|
||||||
|
|
||||||
const ref = context.ref;
|
if (externalRepository) {
|
||||||
if (context.eventName === 'push') {
|
throw new Error(`\
|
||||||
isProhibitedBranch = ref.includes(`refs/heads/${inps.PublishBranch}`);
|
The generated GITHUB_TOKEN (github_token) does not support to push to an external repository.
|
||||||
|
Use deploy_key or personal_token.
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventName === 'push') {
|
||||||
|
isProhibitedBranch = ref.includes(`refs/heads/${publishBranch}`);
|
||||||
if (isProhibitedBranch) {
|
if (isProhibitedBranch) {
|
||||||
throw new Error(
|
throw new Error(`You deploy from ${publishBranch} to ${publishBranch}`);
|
||||||
`You deploy from ${inps.PublishBranch} to ${inps.PublishBranch}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else if (context.eventName === 'pull_request') {
|
|
||||||
// TODO: support pull_request event
|
|
||||||
throw new Error('This action does not support pull_request event now.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isPrivateRepository = payload.repository?.private;
|
return `https://x-access-token:${githubToken}@github.com/${publishRepo}.git`;
|
||||||
if (inps.ExternalRepository) {
|
|
||||||
throw new Error(
|
|
||||||
'GITHUB_TOKEN does not support to push to an external repository'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (isPrivateRepository === false) {
|
|
||||||
core.warning(
|
|
||||||
'GITHUB_TOKEN does not support to trigger the GitHub Pages build event on a public repository'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return `https://x-access-token:${inps.GithubToken}@github.com/${publishRepo}.git`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setPersonalToken(
|
export function setPersonalToken(personalToken: string, publishRepo: string): string {
|
||||||
inps: Inputs,
|
|
||||||
publishRepo: string
|
|
||||||
): Promise<string> {
|
|
||||||
core.info('[INFO] setup personal access token');
|
core.info('[INFO] setup personal access token');
|
||||||
return `https://x-access-token:${inps.PersonalToken}@github.com/${publishRepo}.git`;
|
return `https://x-access-token:${personalToken}@github.com/${publishRepo}.git`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPublishRepo(externalRepository: string, owner: string, repo: string): string {
|
||||||
|
if (externalRepository) {
|
||||||
|
return externalRepository;
|
||||||
|
}
|
||||||
|
return `${owner}/${repo}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setTokens(inps: Inputs): Promise<string> {
|
export async function setTokens(inps: Inputs): Promise<string> {
|
||||||
try {
|
try {
|
||||||
const publishRepo = setPublishRepo(inps);
|
const publishRepo = getPublishRepo(
|
||||||
|
inps.ExternalRepository,
|
||||||
|
github.context.repo.owner,
|
||||||
|
github.context.repo.repo
|
||||||
|
);
|
||||||
if (inps.DeployKey) {
|
if (inps.DeployKey) {
|
||||||
return setSSHKey(inps, publishRepo);
|
return setSSHKey(inps, publishRepo);
|
||||||
} else if (inps.GithubToken) {
|
} else if (inps.GithubToken) {
|
||||||
return setGithubToken(inps, publishRepo);
|
const context = github.context;
|
||||||
|
const ref = context.ref;
|
||||||
|
const eventName = context.eventName;
|
||||||
|
return setGithubToken(
|
||||||
|
inps.GithubToken,
|
||||||
|
publishRepo,
|
||||||
|
inps.PublishBranch,
|
||||||
|
inps.ExternalRepository,
|
||||||
|
ref,
|
||||||
|
eventName
|
||||||
|
);
|
||||||
} else if (inps.PersonalToken) {
|
} else if (inps.PersonalToken) {
|
||||||
return setPersonalToken(inps, publishRepo);
|
return setPersonalToken(inps.PersonalToken, publishRepo);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('not found deploy key or tokens');
|
throw new Error('not found deploy key or tokens');
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
63
src/utils.ts
@@ -1,6 +1,9 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
import * as io from '@actions/io';
|
||||||
|
import path from 'path';
|
||||||
|
import fs from 'fs';
|
||||||
|
|
||||||
export function getHomeDir(): string {
|
export async function getHomeDir(): Promise<string> {
|
||||||
let homedir = '';
|
let homedir = '';
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
@@ -13,3 +16,61 @@ export function getHomeDir(): string {
|
|||||||
|
|
||||||
return homedir;
|
return homedir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getWorkDirName(unixTime: string): Promise<string> {
|
||||||
|
const homeDir = await getHomeDir();
|
||||||
|
const workDirName = path.join(homeDir, `actions_github_pages_${unixTime}`);
|
||||||
|
return workDirName;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function createWorkDir(workDirName: string): Promise<void> {
|
||||||
|
await io.mkdirP(workDirName);
|
||||||
|
core.debug(`Created: ${workDirName}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function addNoJekyll(
|
||||||
|
workDir: string,
|
||||||
|
DisableNoJekyll: boolean,
|
||||||
|
PublishBranch: string
|
||||||
|
): Promise<void> {
|
||||||
|
if (DisableNoJekyll) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (PublishBranch === 'master' || PublishBranch === 'gh-pages') {
|
||||||
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
if (fs.existsSync(filepath)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.closeSync(fs.openSync(filepath, 'w'));
|
||||||
|
core.info(`[INFO] Created ${filepath}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function addCNAME(workDir: string, content: string): Promise<void> {
|
||||||
|
if (content === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const filepath = path.join(workDir, 'CNAME');
|
||||||
|
if (fs.existsSync(filepath)) {
|
||||||
|
core.warning(`CNAME already exists, skip adding CNAME`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fs.writeFileSync(filepath, content + '\n');
|
||||||
|
core.info(`[INFO] Created ${filepath}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function skipOnFork(
|
||||||
|
isForkRepository: boolean,
|
||||||
|
githubToken: string,
|
||||||
|
deployKey: string,
|
||||||
|
personalToken: string
|
||||||
|
): Promise<boolean> {
|
||||||
|
if (isForkRepository) {
|
||||||
|
if (githubToken === '' && deployKey === '' && personalToken === '') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||