Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug report
|
||||||
about: Create a report to help us improve
|
about: Create a report to help us improve
|
||||||
title: 'Bug: This is a sample issue title'
|
title: 'sample_title'
|
||||||
labels: bug
|
labels: bug
|
||||||
assignees: peaceiris
|
assignees: peaceiris
|
||||||
|
|
||||||
|
|||||||
7
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -3,6 +3,9 @@ contact_links:
|
|||||||
- name: GitHub Actions Community Forum
|
- name: GitHub Actions Community Forum
|
||||||
url: https://github.community/t5/GitHub-Actions/bd-p/actions
|
url: https://github.community/t5/GitHub-Actions/bd-p/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.
|
||||||
|
|||||||
2
.github/ISSUE_TEMPLATE/proposal.md
vendored
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: Proposal
|
name: Proposal
|
||||||
about: Suggest an idea for this project
|
about: Suggest an idea for this project
|
||||||
title: 'proposal: This is a sample title'
|
title: 'sample_title'
|
||||||
labels: proposal
|
labels: proposal
|
||||||
assignees: peaceiris
|
assignees: peaceiris
|
||||||
|
|
||||||
|
|||||||
31
.github/ISSUE_TEMPLATE/user_support.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
name: User support
|
||||||
|
about: Questions for this action
|
||||||
|
title: 'sample_title'
|
||||||
|
labels: support
|
||||||
|
assignees: peaceiris
|
||||||
|
---
|
||||||
|
|
||||||
|
**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)
|
||||||
|
|
||||||
|
**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.
|
||||||
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
|
||||||
7
.github/workflows/release.yml
vendored
@@ -3,13 +3,12 @@ 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
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Dump GitHub context
|
- name: Dump GitHub context
|
||||||
@@ -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:
|
||||||
|
|||||||
16
.github/workflows/stale.yml
vendored
@@ -2,16 +2,16 @@ name: "Stale"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "6 6 * * *"
|
- cron: "6 6 * * *"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/stale@v1
|
- uses: actions/stale@v1
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
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-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.'
|
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-stale: 21
|
||||||
days-before-close: 7
|
days-before-close: 7
|
||||||
|
|||||||
12
.github/workflows/test-action.yml
vendored
@@ -41,6 +41,14 @@ jobs:
|
|||||||
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: Remove lint-staged husky
|
- name: Remove lint-staged husky
|
||||||
@@ -79,8 +87,8 @@ jobs:
|
|||||||
allow_empty_commit: true
|
allow_empty_commit: true
|
||||||
# keep_files: true
|
# keep_files: true
|
||||||
# force_orphan: true
|
# force_orphan: true
|
||||||
# user_name: iris
|
user_name: 'github-actions[bot]'
|
||||||
# user_email: email@peaceiris.com
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
||||||
# commit_message: ${{ github.event.head_commit.message }}
|
# commit_message: ${{ github.event.head_commit.message }}
|
||||||
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
|
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
|
||||||
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
|
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
|
||||||
|
|||||||
9
.github/workflows/test.yml
vendored
@@ -29,7 +29,6 @@ jobs:
|
|||||||
- 'macos-latest'
|
- 'macos-latest'
|
||||||
- 'windows-latest'
|
- 'windows-latest'
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Read .nvmrc
|
- name: Read .nvmrc
|
||||||
@@ -41,6 +40,14 @@ jobs:
|
|||||||
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
|
||||||
|
|||||||
192
CHANGELOG.md
@@ -2,6 +2,198 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
## [3.5.4](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.3...v3.5.4) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* skip deployment on forks (#156) ([4f06df8](https://github.com/peaceiris/actions-gh-pages/commit/4f06df820b7a5882e2faef0e6929bb670140fba0)), closes [#156](https://github.com/peaceiris/actions-gh-pages/issues/156) [#153](https://github.com/peaceiris/actions-gh-pages/issues/153)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.4-6](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-5...v3.5.4-6) (2020-03-15)
|
||||||
|
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* skip logic ([44bdada](https://github.com/peaceiris/actions-gh-pages/commit/44bdada02c71f646d23ffefe1ea07d16386dbf83))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.4-5](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-4...v3.5.4-5) (2020-03-14)
|
||||||
|
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* property access ([72f58a0](https://github.com/peaceiris/actions-gh-pages/commit/72f58a06cf5db88d3eb982f57de8dbc266e39232))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.4-4](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-3...v3.5.4-4) (2020-03-14)
|
||||||
|
|
||||||
|
|
||||||
|
### test
|
||||||
|
|
||||||
|
* skipOnFork() ([6f9a5b7](https://github.com/peaceiris/actions-gh-pages/commit/6f9a5b7a66bbf855cadc34099fa6450c40eff4a2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.4-3](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-2...v3.5.4-3) (2020-03-14)
|
||||||
|
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* skip logic ([01976c9](https://github.com/peaceiris/actions-gh-pages/commit/01976c9d9b95b42997caa2a85c2d737eb75e852e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.4-2](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-1...v3.5.4-2) (2020-03-14)
|
||||||
|
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* skip logic ([c97a39a](https://github.com/peaceiris/actions-gh-pages/commit/c97a39a35f681badbf7490c2786eddf06b17316d))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.4-1](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.4-0...v3.5.4-1) (2020-03-14)
|
||||||
|
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* isForkRepository ([6546aa9](https://github.com/peaceiris/actions-gh-pages/commit/6546aa96085e89bd91adc56f58be665766e93a1e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.4-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.3...v3.5.4-0) (2020-03-14)
|
||||||
|
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* skip on forks ([c320668](https://github.com/peaceiris/actions-gh-pages/commit/c320668126b104ad2c15ea1b583a75cd3978c2f3)), closes [#153](https://github.com/peaceiris/actions-gh-pages/issues/153)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.3](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.2...v3.5.3) (2020-03-13)
|
||||||
|
|
||||||
|
|
||||||
|
### deps
|
||||||
|
|
||||||
|
* [security] bump acorn from 6.4.0 to 6.4.1 (#155) ([2fa0a59](https://github.com/peaceiris/actions-gh-pages/commit/2fa0a59e21f19c0862ebc505187b3ede95a92561)), closes [#155](https://github.com/peaceiris/actions-gh-pages/issues/155)
|
||||||
|
* bump @types/node from 12.12.29 to 12.12.30 (#154) ([d1f9877](https://github.com/peaceiris/actions-gh-pages/commit/d1f987783c05614c72b8c5009fbfd941982128ec)), closes [#154](https://github.com/peaceiris/actions-gh-pages/issues/154)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.2](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.1...v3.5.2) (2020-03-12)
|
||||||
|
|
||||||
|
|
||||||
|
### chore
|
||||||
|
|
||||||
|
* reindent ([b2788ae](https://github.com/peaceiris/actions-gh-pages/commit/b2788ae3c6c463fccde4f9db8abac12cf2f42b72))
|
||||||
|
|
||||||
|
### deps
|
||||||
|
|
||||||
|
* bump @typescript-eslint/eslint-plugin from 2.22.0 to 2.23.0 (#150) ([7f32718](https://github.com/peaceiris/actions-gh-pages/commit/7f32718f667956be6bab3cd2dffe9559cdd26fc7)), closes [#150](https://github.com/peaceiris/actions-gh-pages/issues/150)
|
||||||
|
* bump @typescript-eslint/parser from 2.22.0 to 2.23.0 (#149) ([6801987](https://github.com/peaceiris/actions-gh-pages/commit/680198766bcc7c4625ee5c9f599187f99bf0c118)), closes [#149](https://github.com/peaceiris/actions-gh-pages/issues/149)
|
||||||
|
|
||||||
|
### fix
|
||||||
|
|
||||||
|
* set commit author as local config (#152) ([a1ff787](https://github.com/peaceiris/actions-gh-pages/commit/a1ff787715905a17a17d1ab7b42eba976a4553c6)), closes [#152](https://github.com/peaceiris/actions-gh-pages/issues/152) [#151](https://github.com/peaceiris/actions-gh-pages/issues/151)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.5.1](https://github.com/peaceiris/actions-gh-pages/compare/v3.5.0...v3.5.1) (2020-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
### chore
|
||||||
|
|
||||||
|
* [ImgBot] Optimize images (#147) ([d8ed36f](https://github.com/peaceiris/actions-gh-pages/commit/d8ed36f54aee9f59e2e00fa7aceda885cd6d3eb8)), closes [#147](https://github.com/peaceiris/actions-gh-pages/issues/147)
|
||||||
|
* Add missing descriptions ([a7bc3c3](https://github.com/peaceiris/actions-gh-pages/commit/a7bc3c37fdc9c640720165cb06fbffe20febe7a3))
|
||||||
|
* Add user support issue template (#146) ([86214f3](https://github.com/peaceiris/actions-gh-pages/commit/86214f3d7909e3e81e38f0a73a897e00fc1198e4)), closes [#146](https://github.com/peaceiris/actions-gh-pages/issues/146) [#58](https://github.com/peaceiris/actions-gh-pages/issues/58)
|
||||||
|
|
||||||
|
### ci
|
||||||
|
|
||||||
|
* Add GitHub Actions bot as committer ([80c8fe5](https://github.com/peaceiris/actions-gh-pages/commit/80c8fe5fb32cd1e1b866e2d0d0d34cb1ba492586))
|
||||||
|
* fix user_name ([f3b165f](https://github.com/peaceiris/actions-gh-pages/commit/f3b165fbe1a9ec4c9bd8b435ee13fc7cb10ef42a))
|
||||||
|
* fix user_name ([945c44d](https://github.com/peaceiris/actions-gh-pages/commit/945c44d50a26eb6b24dbc0157dd836a39f9d5edb))
|
||||||
|
* update script link [skip ci] ([c279167](https://github.com/peaceiris/actions-gh-pages/commit/c2791671998aa8f7858322a1bb74a1e74fb58923))
|
||||||
|
|
||||||
|
### deps
|
||||||
|
|
||||||
|
* bump @types/jest from 25.1.3 to 25.1.4 (#148) ([a4c25ca](https://github.com/peaceiris/actions-gh-pages/commit/a4c25ca7788f09428015b84ffd661ec30c7f2734)), closes [#148](https://github.com/peaceiris/actions-gh-pages/issues/148)
|
||||||
|
* bump hub 2.14.1 to 2.14.2 ([618792b](https://github.com/peaceiris/actions-gh-pages/commit/618792b2f09d6b33bc394ffa2ffaec5ce48fc15d))
|
||||||
|
|
||||||
|
### docs
|
||||||
|
|
||||||
|
* Add bot committer image ([d2d8e21](https://github.com/peaceiris/actions-gh-pages/commit/d2d8e21d7ee28e4ab68e977f54ce0de33f9ae3ba))
|
||||||
|
* Add GitHub Actions bot committer ([81884ef](https://github.com/peaceiris/actions-gh-pages/commit/81884efe7cbee81f6d73a96037ac547b3eda1b78))
|
||||||
|
* Add notes about GitHub_TOKEN (#145) ([6852043](https://github.com/peaceiris/actions-gh-pages/commit/68520436f89fb253238c54f1ad6c5c3681c3e85b)), closes [#145](https://github.com/peaceiris/actions-gh-pages/issues/145)
|
||||||
|
* fix user_name ([9571d29](https://github.com/peaceiris/actions-gh-pages/commit/9571d29e0df7e4a5bd5700f5531848e9158d7a2c))
|
||||||
|
* fix user_name ([eb73e9c](https://github.com/peaceiris/actions-gh-pages/commit/eb73e9cb9d8ed1656b67a83c37e7dc1bc9c0dc00))
|
||||||
|
* fix user_name ([860ed19](https://github.com/peaceiris/actions-gh-pages/commit/860ed1944f8968c2df2e052bd419a015ec10be38))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [3.5.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.4.1...v3.5.0) (2020-03-06)
|
||||||
|
|
||||||
|
|
||||||
|
### deps
|
||||||
|
|
||||||
|
* bump node 12.15.0 to 12.16.1 (#142) ([ade8887](https://github.com/peaceiris/actions-gh-pages/commit/ade88874791f5b67d0c475d6dffb5219ed4407f1)), closes [#142](https://github.com/peaceiris/actions-gh-pages/issues/142)
|
||||||
|
|
||||||
|
### docs
|
||||||
|
|
||||||
|
* improve description of enable_jekyll=disable_nojekyll (see #130) (#132) ([b76751b](https://github.com/peaceiris/actions-gh-pages/commit/b76751b9eefaaf771ce31d8ef3c69a8d907f535d)), closes [#130](https://github.com/peaceiris/actions-gh-pages/issues/130) [#132](https://github.com/peaceiris/actions-gh-pages/issues/132) [#130](https://github.com/peaceiris/actions-gh-pages/issues/130)
|
||||||
|
|
||||||
|
### feat
|
||||||
|
|
||||||
|
* Add enable_jekyll (#143) ([dc1169c](https://github.com/peaceiris/actions-gh-pages/commit/dc1169c5baf9ed1205d6f0f9c9ce0e6d26afb164)), closes [#143](https://github.com/peaceiris/actions-gh-pages/issues/143) [#130](https://github.com/peaceiris/actions-gh-pages/issues/130) [#132](https://github.com/peaceiris/actions-gh-pages/issues/132)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [3.5.0-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.4.1...v3.5.0-0) (2020-03-06)
|
||||||
|
|
||||||
|
|
||||||
|
### deps
|
||||||
|
|
||||||
|
* bump node 12.15.0 to 12.16.1 (#142) ([ade8887](https://github.com/peaceiris/actions-gh-pages/commit/ade88874791f5b67d0c475d6dffb5219ed4407f1)), closes [#142](https://github.com/peaceiris/actions-gh-pages/issues/142)
|
||||||
|
|
||||||
|
### feat
|
||||||
|
|
||||||
|
* Add enable_jekyll ([1fff2ca](https://github.com/peaceiris/actions-gh-pages/commit/1fff2ca84a6b42067a86c6229774aa5e2891a661))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.4.1](https://github.com/peaceiris/actions-gh-pages/compare/v3.4.0...v3.4.1) (2020-03-06)
|
||||||
|
|
||||||
|
|
||||||
|
### ci
|
||||||
|
|
||||||
|
* Add deployment status check workflow (#125) ([b81e21a](https://github.com/peaceiris/actions-gh-pages/commit/b81e21a3dc037a4037bef6bd44bc1bee36d3626f)), closes [#125](https://github.com/peaceiris/actions-gh-pages/issues/125)
|
||||||
|
|
||||||
|
### deps
|
||||||
|
|
||||||
|
* bump @actions/core from 1.2.2 to 1.2.3 (#140) ([ac39f89](https://github.com/peaceiris/actions-gh-pages/commit/ac39f890622b7f6950b6eb9cc43666c033277fb1)), closes [#140](https://github.com/peaceiris/actions-gh-pages/issues/140)
|
||||||
|
* bump @types/node from 12.12.28 to 12.12.29 (#136) ([dd0b5df](https://github.com/peaceiris/actions-gh-pages/commit/dd0b5dfc6981e11137b2a1fad785d5342c0b5bc0)), closes [#136](https://github.com/peaceiris/actions-gh-pages/issues/136)
|
||||||
|
* bump @typescript-eslint/eslint-plugin from 2.20.0 to 2.21.0 (#128) ([ce61f4b](https://github.com/peaceiris/actions-gh-pages/commit/ce61f4bf52b32c725cd5837e7b56d7a587a32af6)), closes [#128](https://github.com/peaceiris/actions-gh-pages/issues/128)
|
||||||
|
* bump @typescript-eslint/eslint-plugin from 2.21.0 to 2.22.0 (#139) ([9faed51](https://github.com/peaceiris/actions-gh-pages/commit/9faed51ce97835a66741dc3d9368dc3402c12174)), closes [#139](https://github.com/peaceiris/actions-gh-pages/issues/139)
|
||||||
|
* bump @typescript-eslint/parser from 2.20.0 to 2.21.0 (#127) ([bc18026](https://github.com/peaceiris/actions-gh-pages/commit/bc18026d43cd46451191723b7502ac0057177f5c)), closes [#127](https://github.com/peaceiris/actions-gh-pages/issues/127)
|
||||||
|
* bump @typescript-eslint/parser from 2.21.0 to 2.22.0 (#138) ([7c45cb4](https://github.com/peaceiris/actions-gh-pages/commit/7c45cb42cade3f3bc0dab3c894044809b8ed4b4a)), closes [#138](https://github.com/peaceiris/actions-gh-pages/issues/138)
|
||||||
|
* bump eslint-plugin-jest from 23.8.0 to 23.8.1 (#134) ([50988c1](https://github.com/peaceiris/actions-gh-pages/commit/50988c17ae540cf540cac254aeae22e8f1cbad46)), closes [#134](https://github.com/peaceiris/actions-gh-pages/issues/134)
|
||||||
|
* bump eslint-plugin-jest from 23.8.1 to 23.8.2 (#141) ([acd0462](https://github.com/peaceiris/actions-gh-pages/commit/acd04627103a2d4d7620edca1bb74897a8180a84)), closes [#141](https://github.com/peaceiris/actions-gh-pages/issues/141)
|
||||||
|
* bump lint-staged from 10.0.7 to 10.0.8 (#129) ([56fe697](https://github.com/peaceiris/actions-gh-pages/commit/56fe6978255c0fb44f70c59879daca5984de7ac4)), closes [#129](https://github.com/peaceiris/actions-gh-pages/issues/129)
|
||||||
|
* bump typescript from 3.8.2 to 3.8.3 (#135) ([140391d](https://github.com/peaceiris/actions-gh-pages/commit/140391da91a8b458871e276b87abbfe7c0557c8c)), closes [#135](https://github.com/peaceiris/actions-gh-pages/issues/135)
|
||||||
|
|
||||||
|
### docs
|
||||||
|
|
||||||
|
* Add Docusaurus example (#131) ([a4da635](https://github.com/peaceiris/actions-gh-pages/commit/a4da635d8c553a327144267b3826e838aefb1561)), closes [#131](https://github.com/peaceiris/actions-gh-pages/issues/131)
|
||||||
|
|
||||||
|
### test
|
||||||
|
|
||||||
|
* Add testing for set-tokens.ts (#126) ([fd6e5fc](https://github.com/peaceiris/actions-gh-pages/commit/fd6e5fc7ce07cfd94a2311f7ac112bd797c3aee7)), closes [#126](https://github.com/peaceiris/actions-gh-pages/issues/126)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [3.4.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.3.0...v3.4.0) (2020-02-24)
|
# [3.4.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.3.0...v3.4.0) (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ RUN apt-get update && \
|
|||||||
wget \
|
wget \
|
||||||
ssh \
|
ssh \
|
||||||
vim && \
|
vim && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
npm i -g npm
|
||||||
|
|
||||||
WORKDIR /git
|
WORKDIR /git
|
||||||
ENV GIT_VERSION="2.25.0"
|
ENV GIT_VERSION="2.25.1"
|
||||||
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" && \
|
||||||
|
|||||||
98
README.md
@@ -42,6 +42,8 @@ Three tokens are supported.
|
|||||||
| `deploy_key` | ✅️ | ✅️ | SSH | Necessary |
|
| `deploy_key` | ✅️ | ✅️ | SSH | Necessary |
|
||||||
| `personal_token` | ✅️ | ✅️ | HTTPS | Necessary |
|
| `personal_token` | ✅️ | ✅️ | HTTPS | Necessary |
|
||||||
|
|
||||||
|
Notes: Actually, the `GitHub_TOKEN` works for deploying to GitHub Pages but it has still some limitations. For the first deployment, we need to select the `gh-pages` branch or `master` branch on the repository settings tab. See [First Deployment with `GITHUB_TOKEN`](#%EF%B8%8F-first-deployment-with-github_token)
|
||||||
|
|
||||||
### Supported Platforms
|
### Supported Platforms
|
||||||
|
|
||||||
| runs-on | `github_token` | `deploy_key` | `personal_token` |
|
| runs-on | `github_token` | `deploy_key` | `personal_token` |
|
||||||
@@ -67,7 +69,7 @@ Three tokens are supported.
|
|||||||
- [⭐️ `deploy_key`](#%EF%B8%8F-deploy_key)
|
- [⭐️ `deploy_key`](#%EF%B8%8F-deploy_key)
|
||||||
- [⭐️ `personal_token`](#%EF%B8%8F-personal_token)
|
- [⭐️ `personal_token`](#%EF%B8%8F-personal_token)
|
||||||
- [⭐️ CNAME](#%EF%B8%8F-cname)
|
- [⭐️ CNAME](#%EF%B8%8F-cname)
|
||||||
- [⭐️ Disable `.nojekyll`](#%EF%B8%8F-disable-nojekyll)
|
- [⭐️ Enable Jekyll](#%EF%B8%8F-enable-jekyll)
|
||||||
- [⭐️ Allow empty commits](#%EF%B8%8F-allow-empty-commits)
|
- [⭐️ Allow empty commits](#%EF%B8%8F-allow-empty-commits)
|
||||||
- [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files)
|
- [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files)
|
||||||
- [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository)
|
- [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository)
|
||||||
@@ -77,12 +79,14 @@ Three tokens are supported.
|
|||||||
- [⭐️ Create Git tag](#%EF%B8%8F-create-git-tag)
|
- [⭐️ Create Git tag](#%EF%B8%8F-create-git-tag)
|
||||||
- [Tips and FAQ](#tips-and-faq)
|
- [Tips and FAQ](#tips-and-faq)
|
||||||
- [⭐️ Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key)
|
- [⭐️ Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key)
|
||||||
|
- [⭐️ First Deployment with `GITHUB_TOKEN`](#%EF%B8%8F-first-deployment-with-github_token)
|
||||||
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
|
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
|
||||||
- [Examples](#examples)
|
- [Examples](#examples)
|
||||||
- [⭐️ Static Site Generators with Node.js](#%EF%B8%8F-static-site-generators-with-nodejs)
|
- [⭐️ Static Site Generators with Node.js](#%EF%B8%8F-static-site-generators-with-nodejs)
|
||||||
- [⭐️ Gatsby](#%EF%B8%8F-gatsby)
|
- [⭐️ Gatsby](#%EF%B8%8F-gatsby)
|
||||||
- [⭐️ React and Next](#%EF%B8%8F-react-and-next)
|
- [⭐️ React and Next](#%EF%B8%8F-react-and-next)
|
||||||
- [⭐️ Vue and Nuxt](#%EF%B8%8F-vue-and-nuxt)
|
- [⭐️ Vue and Nuxt](#%EF%B8%8F-vue-and-nuxt)
|
||||||
|
- [⭐️ Docusaurus](#%EF%B8%8F-docusaurus)
|
||||||
- [⭐️ Static Site Generators with Python](#%EF%B8%8F-static-site-generators-with-python)
|
- [⭐️ Static Site Generators with Python](#%EF%B8%8F-static-site-generators-with-python)
|
||||||
- [⭐️ mdBook (Rust)](#%EF%B8%8F-mdbook-rust)
|
- [⭐️ mdBook (Rust)](#%EF%B8%8F-mdbook-rust)
|
||||||
- [⭐️ Flutter Web](#%EF%B8%8F-flutter-web)
|
- [⭐️ Flutter Web](#%EF%B8%8F-flutter-web)
|
||||||
@@ -139,13 +143,9 @@ jobs:
|
|||||||
|
|
||||||
The above example is for [Project Pages sites]. (`<username>/<project_name>` repository)
|
The above example is for [Project Pages sites]. (`<username>/<project_name>` repository)
|
||||||
|
|
||||||
| Actions log overview | Build step log |
|
| Actions log overview | GitHub Pages log |
|
||||||
|---|---|
|
|---|---|
|
||||||
|  |  |
|
|  |  |
|
||||||
|
|
||||||
| Deploy step log | GitHub Pages log |
|
|
||||||
|---|---|
|
|
||||||
|  |  |
|
|
||||||
|
|
||||||
### ⭐️ Repository type - User and Organization
|
### ⭐️ Repository type - User and Organization
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ jobs:
|
|||||||
|
|
||||||
### ⭐️ `deploy_key`
|
### ⭐️ `deploy_key`
|
||||||
|
|
||||||
Read [⭐️ Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key), create your SSH deploy key, and set the `deploy_key` option like the following.
|
Read [Create SSH Deploy Key](#%EF%B8%8F-create-ssh-deploy-key), create your SSH deploy key, and set the `deploy_key` option like the following.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
@@ -230,11 +230,14 @@ For more details about `CNAME`, read the official documentation: [Managing a cus
|
|||||||
cname: github.com
|
cname: github.com
|
||||||
```
|
```
|
||||||
|
|
||||||
### ⭐️ Disable `.nojekyll`
|
### ⭐️ Enable Jekyll
|
||||||
|
|
||||||
By default, this action adds the `.nojekyll` file to only the `master` and `gh-pages` branches. When the file already exists, this action does nothing.
|
If you want GitHub Pages to process the site with the static site generator Jekyll, set `enable_jekyll` to true.
|
||||||
|
|
||||||
|
By default, this action signals to GitHub Pages that the site shall not be processed with Jekyll. This is done by adding an empty `.nojekyll` file when publishing to the master or gh-pages branch. When a `.nojekyll` file already exists, this action does nothing.
|
||||||
|
|
||||||
|
Bypassing Jekyll makes the deployment faster and is necessary if you are deploying files or directories that start with underscores, since Jekyll considers these to be special resources and does not copy them to the final site. You only need to set `enable_jekyll` to true when you want to deploy a Jekyll-powered website and let GitHub Pages do the Jekyll processing.
|
||||||
|
|
||||||
To disable this behavior, we can set the `disable_nojekyll` option to `true`.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
@@ -242,7 +245,7 @@ To disable this behavior, we can set the `disable_nojekyll` option to `true`.
|
|||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./public
|
publish_dir: ./public
|
||||||
disable_nojekyll: true
|
enable_jekyll: true
|
||||||
```
|
```
|
||||||
|
|
||||||
For more details about `.nojekyll`: [Bypassing Jekyll on GitHub Pages - The GitHub Blog](https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/)
|
For more details about `.nojekyll`: [Bypassing Jekyll on GitHub Pages - The GitHub Blog](https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/)
|
||||||
@@ -324,10 +327,12 @@ A commit is always created with the same user.
|
|||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./public
|
publish_dir: ./public
|
||||||
user_name: iris
|
user_name: 'github-actions[bot]'
|
||||||
user_email: iris@peaceiris.com
|
user_email: 'github-actions[bot]@users.noreply.github.com'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<img width="400px" alt="Add GitHub Actions bot as a committer" src="./images/committer_github_actions_bot.jpg">
|
||||||
|
|
||||||
### ⭐️ Set custom commit message
|
### ⭐️ Set custom commit message
|
||||||
|
|
||||||
Set custom commit message.
|
Set custom commit message.
|
||||||
@@ -427,6 +432,18 @@ Next, Go to **Repository Settings**
|
|||||||
|---|---|
|
|---|---|
|
||||||
|  |  |
|
|  |  |
|
||||||
|
|
||||||
|
### ⭐️ First Deployment with `GITHUB_TOKEN`
|
||||||
|
|
||||||
|
The `GITHUB_TOKEN` has limitations for the first deployment so we have to select the GitHub Pages branch on the repository settings tab.
|
||||||
|
|
||||||
|
| First deployment failed | Go to the settings tab |
|
||||||
|
|---|---|
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
| Select branch | Deploying again and succeed |
|
||||||
|
|---|---|
|
||||||
|
|  |  |
|
||||||
|
|
||||||
### ⭐️ Use the latest and specific release
|
### ⭐️ Use the latest and specific release
|
||||||
|
|
||||||
We recommend you to use the latest and specific release of this action for stable CI/CD.
|
We recommend you to use the latest and specific release of this action for stable CI/CD.
|
||||||
@@ -635,6 +652,59 @@ jobs:
|
|||||||
publish_dir: ./dist
|
publish_dir: ./dist
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### ⭐️ Docusaurus
|
||||||
|
|
||||||
|
An example for pages created using [Docusaurus](https://docusaurus.io/).
|
||||||
|
|
||||||
|
Examples where this is being used:
|
||||||
|
|
||||||
|
- [Mittens](https://github.com/ExpediaGroup/mittens)
|
||||||
|
- [graphql-kotlin](https://github.com/ExpediaGroup/graphql-kotlin)
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: github pages
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- 'docs/**'
|
||||||
|
- 'website/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: 12
|
||||||
|
|
||||||
|
- name: Cache dependencies
|
||||||
|
uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('website/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cd website
|
||||||
|
npm ci
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# use the projectName from your siteConfig.js file: https://docusaurus.io/docs/en/site-config#projectname-string
|
||||||
|
publish_dir: ./website/build/<projectName>
|
||||||
|
```
|
||||||
|
|
||||||
### ⭐️ Static Site Generators with Python
|
### ⭐️ Static Site Generators with Python
|
||||||
|
|
||||||
[pelican], [MkDocs], [sphinx], etc.
|
[pelican], [MkDocs], [sphinx], etc.
|
||||||
|
|||||||
@@ -1,37 +1,107 @@
|
|||||||
// 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(
|
||||||
delete process.env['INPUT_GITHUB_TOKEN'];
|
fs.readFileSync(__dirname + '/../action.yml', 'utf8')
|
||||||
delete process.env['INPUT_PERSONAL_TOKEN'];
|
);
|
||||||
delete process.env['INPUT_PUBLISH_BRANCH'];
|
Object.keys(doc.inputs).forEach(name => {
|
||||||
delete process.env['INPUT_PUBLISH_DIR'];
|
const envVar = `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||||
delete process.env['INPUT_EXTERNAL_REPOSITORY'];
|
console.debug(`delete ${envVar}\t${process.env[envVar]}`);
|
||||||
delete process.env['INPUT_ALLOW_EMPTY_COMMIT'];
|
delete process.env[envVar];
|
||||||
delete process.env['INPUT_KEEP_FILES'];
|
});
|
||||||
delete process.env['INPUT_FORCE_ORPHAN'];
|
});
|
||||||
delete process.env['INPUT_USER_NAME'];
|
|
||||||
delete process.env['INPUT_USER_EMAIL'];
|
// Assert that process.stdout.write calls called only with the given arguments.
|
||||||
delete process.env['INPUT_COMMIT_MESSAGE'];
|
// cf. https://github.com/actions/toolkit/blob/8b0300129f08728419263b016de8630f1d426d5f/packages/core/__tests__/core.test.ts
|
||||||
delete process.env['INPUT_TAG_NAME'];
|
function assertWriteCalls(calls: string[]): void {
|
||||||
delete process.env['INPUT_TAG_MESSAGE'];
|
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length);
|
||||||
delete process.env['INPUT_DISABLE_NOJEKYLL'];
|
|
||||||
delete process.env['INPUT_CNAME'];
|
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] 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';
|
|
||||||
|
|
||||||
const inps: Inputs = getInputs();
|
const inps: Inputs = getInputs();
|
||||||
|
|
||||||
@@ -90,4 +160,14 @@ describe('getInputs()', () => {
|
|||||||
expect(inps.DisableNoJekyll).toBe(true);
|
expect(inps.DisableNoJekyll).toBe(true);
|
||||||
expect(inps.CNAME).toMatch('github.com');
|
expect(inps.CNAME).toMatch('github.com');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
116
__tests__/git-utils.test.ts
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
import {getUserName, getUserEmail, setCommitAuthor} 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'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
105
__tests__/set-tokens.test.ts
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
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(
|
||||||
|
'GITHUB_TOKEN does not support to push to an external repository'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -5,7 +5,8 @@ import {
|
|||||||
getWorkDirName,
|
getWorkDirName,
|
||||||
createWorkDir,
|
createWorkDir,
|
||||||
addNoJekyll,
|
addNoJekyll,
|
||||||
addCNAME
|
addCNAME,
|
||||||
|
skipOnFork
|
||||||
} from '../src/utils';
|
} from '../src/utils';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -77,8 +78,8 @@ describe('addNoJekyll()', () => {
|
|||||||
const filepath = path.join(workDir, '.nojekyll');
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
await addNoJekyll(workDir, false, 'gh-pages');
|
await addNoJekyll(workDir, false, 'gh-pages');
|
||||||
const test1 = fs.existsSync(filepath);
|
const test = fs.existsSync(filepath);
|
||||||
expect(test1).toBe(true);
|
expect(test).toBe(true);
|
||||||
|
|
||||||
fs.unlinkSync(filepath);
|
fs.unlinkSync(filepath);
|
||||||
});
|
});
|
||||||
@@ -91,8 +92,23 @@ describe('addNoJekyll()', () => {
|
|||||||
const filepath = path.join(workDir, '.nojekyll');
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
await addNoJekyll(workDir, false, 'master');
|
await addNoJekyll(workDir, false, 'master');
|
||||||
const test2 = fs.existsSync(filepath);
|
const test = fs.existsSync(filepath);
|
||||||
expect(test2).toBe(true);
|
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);
|
fs.unlinkSync(filepath);
|
||||||
});
|
});
|
||||||
@@ -105,8 +121,8 @@ describe('addNoJekyll()', () => {
|
|||||||
const filepath = path.join(workDir, '.nojekyll');
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
await addNoJekyll(workDir, true, 'gh-pages');
|
await addNoJekyll(workDir, true, 'gh-pages');
|
||||||
const test3 = fs.existsSync(filepath);
|
const test = fs.existsSync(filepath);
|
||||||
expect(test3).toBe(false);
|
expect(test).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('not add .nojekyll disable_nojekyll master', async () => {
|
test('not add .nojekyll disable_nojekyll master', async () => {
|
||||||
@@ -117,8 +133,8 @@ describe('addNoJekyll()', () => {
|
|||||||
const filepath = path.join(workDir, '.nojekyll');
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
await addNoJekyll(workDir, true, 'master');
|
await addNoJekyll(workDir, true, 'master');
|
||||||
const test4 = fs.existsSync(filepath);
|
const test = fs.existsSync(filepath);
|
||||||
expect(test4).toBe(false);
|
expect(test).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('not add .nojekyll other-branch', async () => {
|
test('not add .nojekyll other-branch', async () => {
|
||||||
@@ -129,8 +145,8 @@ describe('addNoJekyll()', () => {
|
|||||||
const filepath = path.join(workDir, '.nojekyll');
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
await addNoJekyll(workDir, false, 'other-branch');
|
await addNoJekyll(workDir, false, 'other-branch');
|
||||||
const test5 = fs.existsSync(filepath);
|
const test = fs.existsSync(filepath);
|
||||||
expect(test5).toBe(false);
|
expect(test).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('not add .nojekyll disable_nojekyll other-branch', async () => {
|
test('not add .nojekyll disable_nojekyll other-branch', async () => {
|
||||||
@@ -141,8 +157,8 @@ describe('addNoJekyll()', () => {
|
|||||||
const filepath = path.join(workDir, '.nojekyll');
|
const filepath = path.join(workDir, '.nojekyll');
|
||||||
|
|
||||||
await addNoJekyll(workDir, true, 'other-branch');
|
await addNoJekyll(workDir, true, 'other-branch');
|
||||||
const test6 = fs.existsSync(filepath);
|
const test = fs.existsSync(filepath);
|
||||||
expect(test6).toBe(false);
|
expect(test).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -155,8 +171,8 @@ describe('addCNAME()', () => {
|
|||||||
const filepath = path.join(workDir, 'CNAME');
|
const filepath = path.join(workDir, 'CNAME');
|
||||||
|
|
||||||
await addCNAME(workDir, 'github.com');
|
await addCNAME(workDir, 'github.com');
|
||||||
const test1 = fs.readFileSync(filepath, 'utf8');
|
const test = fs.readFileSync(filepath, 'utf8');
|
||||||
expect(test1).toMatch('github.com');
|
expect(test).toMatch('github.com');
|
||||||
|
|
||||||
fs.unlinkSync(filepath);
|
fs.unlinkSync(filepath);
|
||||||
});
|
});
|
||||||
@@ -169,8 +185,8 @@ describe('addCNAME()', () => {
|
|||||||
const filepath = path.join(workDir, 'CNAME');
|
const filepath = path.join(workDir, 'CNAME');
|
||||||
|
|
||||||
await addCNAME(workDir, '');
|
await addCNAME(workDir, '');
|
||||||
const test2 = fs.existsSync(filepath);
|
const test = fs.existsSync(filepath);
|
||||||
expect(test2).toBe(false);
|
expect(test).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('CNAME already exists', async () => {
|
test('CNAME already exists', async () => {
|
||||||
@@ -182,9 +198,36 @@ describe('addCNAME()', () => {
|
|||||||
|
|
||||||
await addCNAME(workDir, 'github.io');
|
await addCNAME(workDir, 'github.io');
|
||||||
await addCNAME(workDir, 'github.com');
|
await addCNAME(workDir, 'github.com');
|
||||||
const test3 = fs.readFileSync(filepath, 'utf8');
|
const test = fs.readFileSync(filepath, 'utf8');
|
||||||
expect(test3).toMatch('github.io');
|
expect(test).toMatch('github.io');
|
||||||
|
|
||||||
fs.unlinkSync(filepath);
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|||||||
18
action.yml
@@ -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'
|
||||||
@@ -55,8 +55,12 @@ 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:
|
disable_nojekyll:
|
||||||
description: 'Disable adding .nojekyll file to master or gh-pages branches'
|
description: 'An alias for enable_jekyll to disable adding .nojekyll file to master or gh-pages branches'
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
cname:
|
cname:
|
||||||
|
|||||||
BIN
images/committer_github_actions_bot.jpg
Normal file
|
After Width: | Height: | Size: 14 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 |
1589
lib/index.js
116
package-lock.json
generated
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "actions-github-pages",
|
"name": "actions-github-pages",
|
||||||
"version": "3.4.0",
|
"version": "3.5.4",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.3.tgz",
|
||||||
"integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
|
"integrity": "sha512-Wp4xnyokakM45Uuj4WLUxdsa8fJjKVl1fDTsPbTEcTcuu0Nb26IPQbOtjmnfaCPGcaoPOOqId8H9NapZ8gii4w=="
|
||||||
},
|
},
|
||||||
"@actions/exec": {
|
"@actions/exec": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
@@ -740,15 +740,21 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/jest": {
|
"@types/jest": {
|
||||||
"version": "25.1.3",
|
"version": "25.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.4.tgz",
|
||||||
"integrity": "sha512-jqargqzyJWgWAJCXX96LBGR/Ei7wQcZBvRv0PLEu9ZByMfcs23keUJrKv9FMR6YZf9YCbfqDqgmY+JUBsnqhrg==",
|
"integrity": "sha512-QDDY2uNAhCV7TMCITrxz+MRk1EizcsevzfeS6LykIlq2V1E5oO4wXG8V2ZEd9w7Snxeeagk46YbMgZ8ESHx3sw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"jest-diff": "^25.1.0",
|
"jest-diff": "^25.1.0",
|
||||||
"pretty-format": "^25.1.0"
|
"pretty-format": "^25.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/js-yaml": {
|
||||||
|
"version": "3.12.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-3.12.2.tgz",
|
||||||
|
"integrity": "sha512-0CFu/g4mDSNkodVwWijdlr8jH7RoplRWNgovjFLEZeT+QEbbZXjBmCe3HwaWheAlCbHwomTwzZoSedeOycABug==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/json-schema": {
|
"@types/json-schema": {
|
||||||
"version": "7.0.4",
|
"version": "7.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.4.tgz",
|
||||||
@@ -756,9 +762,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "12.12.28",
|
"version": "12.12.30",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.28.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.30.tgz",
|
||||||
"integrity": "sha512-g73GJYJDXgf0jqg+P9S8h2acWbDXNkoCX8DLtJVu7Fkn788pzQ/oJsrdJz/2JejRf/SjfZaAhsw+3nd1D5EWGg=="
|
"integrity": "sha512-sz9MF/zk6qVr3pAnM0BSQvYIBK44tS75QC5N+VbWSE4DjCV/pJ+UzCW/F+vVnl7TkOPcuwQureKNtSSwjBTaMg=="
|
||||||
},
|
},
|
||||||
"@types/parse-json": {
|
"@types/parse-json": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
@@ -788,12 +794,12 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/eslint-plugin": {
|
"@typescript-eslint/eslint-plugin": {
|
||||||
"version": "2.20.0",
|
"version": "2.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.23.0.tgz",
|
||||||
"integrity": "sha512-cimIdVDV3MakiGJqMXw51Xci6oEDEoPkvh8ggJe2IIzcc0fYqAxOXN6Vbeanahz6dLZq64W+40iUEc9g32FLDQ==",
|
"integrity": "sha512-8iA4FvRsz8qTjR0L/nK9RcRUN3QtIHQiOm69FzV7WS3SE+7P7DyGGwh3k4UNR2JBbk+Ej2Io+jLAaqKibNhmtw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/experimental-utils": "2.20.0",
|
"@typescript-eslint/experimental-utils": "2.23.0",
|
||||||
"eslint-utils": "^1.4.3",
|
"eslint-utils": "^1.4.3",
|
||||||
"functional-red-black-tree": "^1.0.1",
|
"functional-red-black-tree": "^1.0.1",
|
||||||
"regexpp": "^3.0.0",
|
"regexpp": "^3.0.0",
|
||||||
@@ -801,20 +807,20 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/experimental-utils": {
|
"@typescript-eslint/experimental-utils": {
|
||||||
"version": "2.20.0",
|
"version": "2.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz",
|
||||||
"integrity": "sha512-fEBy9xYrwG9hfBLFEwGW2lKwDRTmYzH3DwTmYbT+SMycmxAoPl0eGretnBFj/s+NfYBG63w/5c3lsvqqz5mYag==",
|
"integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/json-schema": "^7.0.3",
|
"@types/json-schema": "^7.0.3",
|
||||||
"@typescript-eslint/typescript-estree": "2.20.0",
|
"@typescript-eslint/typescript-estree": "2.23.0",
|
||||||
"eslint-scope": "^5.0.0"
|
"eslint-scope": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "2.20.0",
|
"version": "2.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz",
|
||||||
"integrity": "sha512-WlFk8QtI8pPaE7JGQGxU7nGcnk1ccKAJkhbVookv94ZcAef3m6oCE/jEDL6dGte3JcD7reKrA0o55XhBRiVT3A==",
|
"integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
@@ -835,43 +841,43 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/experimental-utils": {
|
"@typescript-eslint/experimental-utils": {
|
||||||
"version": "2.20.0",
|
"version": "2.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz",
|
||||||
"integrity": "sha512-fEBy9xYrwG9hfBLFEwGW2lKwDRTmYzH3DwTmYbT+SMycmxAoPl0eGretnBFj/s+NfYBG63w/5c3lsvqqz5mYag==",
|
"integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/json-schema": "^7.0.3",
|
"@types/json-schema": "^7.0.3",
|
||||||
"@typescript-eslint/typescript-estree": "2.20.0",
|
"@typescript-eslint/typescript-estree": "2.22.0",
|
||||||
"eslint-scope": "^5.0.0"
|
"eslint-scope": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/parser": {
|
"@typescript-eslint/parser": {
|
||||||
"version": "2.20.0",
|
"version": "2.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.23.0.tgz",
|
||||||
"integrity": "sha512-o8qsKaosLh2qhMZiHNtaHKTHyCHc3Triq6aMnwnWj7budm3xAY9owSZzV1uon5T9cWmJRJGzTFa90aex4m77Lw==",
|
"integrity": "sha512-k61pn/Nepk43qa1oLMiyqApC6x5eP5ddPz6VUYXCAuXxbmRLqkPYzkFRKl42ltxzB2luvejlVncrEpflgQoSUg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/eslint-visitor-keys": "^1.0.0",
|
"@types/eslint-visitor-keys": "^1.0.0",
|
||||||
"@typescript-eslint/experimental-utils": "2.20.0",
|
"@typescript-eslint/experimental-utils": "2.23.0",
|
||||||
"@typescript-eslint/typescript-estree": "2.20.0",
|
"@typescript-eslint/typescript-estree": "2.23.0",
|
||||||
"eslint-visitor-keys": "^1.1.0"
|
"eslint-visitor-keys": "^1.1.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/experimental-utils": {
|
"@typescript-eslint/experimental-utils": {
|
||||||
"version": "2.20.0",
|
"version": "2.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz",
|
||||||
"integrity": "sha512-fEBy9xYrwG9hfBLFEwGW2lKwDRTmYzH3DwTmYbT+SMycmxAoPl0eGretnBFj/s+NfYBG63w/5c3lsvqqz5mYag==",
|
"integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/json-schema": "^7.0.3",
|
"@types/json-schema": "^7.0.3",
|
||||||
"@typescript-eslint/typescript-estree": "2.20.0",
|
"@typescript-eslint/typescript-estree": "2.23.0",
|
||||||
"eslint-scope": "^5.0.0"
|
"eslint-scope": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "2.20.0",
|
"version": "2.23.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz",
|
||||||
"integrity": "sha512-WlFk8QtI8pPaE7JGQGxU7nGcnk1ccKAJkhbVookv94ZcAef3m6oCE/jEDL6dGte3JcD7reKrA0o55XhBRiVT3A==",
|
"integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
@@ -892,9 +898,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "2.20.0",
|
"version": "2.22.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz",
|
||||||
"integrity": "sha512-WlFk8QtI8pPaE7JGQGxU7nGcnk1ccKAJkhbVookv94ZcAef3m6oCE/jEDL6dGte3JcD7reKrA0o55XhBRiVT3A==",
|
"integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
@@ -937,9 +943,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"acorn": {
|
"acorn": {
|
||||||
"version": "7.1.0",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz",
|
||||||
"integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==",
|
"integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"acorn-globals": {
|
"acorn-globals": {
|
||||||
@@ -953,9 +959,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"acorn": {
|
"acorn": {
|
||||||
"version": "6.4.0",
|
"version": "6.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz",
|
||||||
"integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==",
|
"integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2385,9 +2391,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-plugin-jest": {
|
"eslint-plugin-jest": {
|
||||||
"version": "23.8.0",
|
"version": "23.8.2",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.2.tgz",
|
||||||
"integrity": "sha512-DKXmLxguZ1Lru4u5YM12ko3WLq6gqo7dhV2b63K731+/PNyZ/Ff6NGONQsGUtPLG9zU3kdz/N+2LTbweNZifeg==",
|
"integrity": "sha512-xwbnvOsotSV27MtAe7s8uGWOori0nUsrXh2f1EnpmXua8sDfY6VZhHAhHg2sqK7HBNycRQExF074XSZ7DvfoFg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/experimental-utils": "^2.5.0"
|
"@typescript-eslint/experimental-utils": "^2.5.0"
|
||||||
@@ -4598,9 +4604,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"version": "10.0.7",
|
"version": "10.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-10.0.8.tgz",
|
||||||
"integrity": "sha512-Byj0F4l7GYUpYYHEqyFH69NiI6ICTg0CeCKbhRorL+ickbzILKUlZLiyCkljZV02wnoh7yH7PmFyYm9PRNwk9g==",
|
"integrity": "sha512-Oa9eS4DJqvQMVdywXfEor6F4vP+21fPHF8LUXgBbVWUSWBddjqsvO6Bv1LwMChmgQZZqwUvgJSHlu8HFHAPZmA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"chalk": "^3.0.0",
|
"chalk": "^3.0.0",
|
||||||
@@ -7507,9 +7513,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"typescript": {
|
"typescript": {
|
||||||
"version": "3.8.2",
|
"version": "3.8.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
|
||||||
"integrity": "sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==",
|
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uglify-js": {
|
"uglify-js": {
|
||||||
|
|||||||
22
package.json
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"name": "actions-github-pages",
|
"name": "actions-github-pages",
|
||||||
"version": "3.4.0",
|
"version": "3.5.4",
|
||||||
"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.1",
|
||||||
"npm": ">=6.13.7"
|
"npm": ">=6.14.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint ./{src,__tests__}/**/*.ts",
|
"lint": "eslint ./{src,__tests__}/**/*.ts",
|
||||||
@@ -50,26 +50,28 @@
|
|||||||
},
|
},
|
||||||
"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.3",
|
||||||
"@actions/exec": "^1.0.3",
|
"@actions/exec": "^1.0.3",
|
||||||
"@actions/github": "^2.1.1",
|
"@actions/github": "^2.1.1",
|
||||||
"@actions/io": "^1.0.2"
|
"@actions/io": "^1.0.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^25.1.3",
|
"@types/jest": "^25.1.4",
|
||||||
|
"@types/js-yaml": "^3.12.2",
|
||||||
"@types/node": "~12",
|
"@types/node": "~12",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.20.0",
|
"@typescript-eslint/eslint-plugin": "^2.23.0",
|
||||||
"@typescript-eslint/parser": "^2.20.0",
|
"@typescript-eslint/parser": "^2.23.0",
|
||||||
"@zeit/ncc": "^0.21.1",
|
"@zeit/ncc": "^0.21.1",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-jest": "^23.8.0",
|
"eslint-plugin-jest": "^23.8.2",
|
||||||
"husky": "^4.2.3",
|
"husky": "^4.2.3",
|
||||||
"jest": "^25.1.0",
|
"jest": "^25.1.0",
|
||||||
"jest-circus": "^25.1.0",
|
"jest-circus": "^25.1.0",
|
||||||
"lint-staged": "^10.0.7",
|
"js-yaml": "^3.13.1",
|
||||||
|
"lint-staged": "^10.0.8",
|
||||||
"prettier": "1.19.1",
|
"prettier": "1.19.1",
|
||||||
"standard-version": "^7.1.0",
|
"standard-version": "^7.1.0",
|
||||||
"ts-jest": "^25.2.1",
|
"ts-jest": "^25.2.1",
|
||||||
"typescript": "^3.8.2"
|
"typescript": "^3.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,50 @@
|
|||||||
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] UserName: ${inps.UserName}`);
|
[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}
|
||||||
core.info(`[INFO] DisableNoJekyll: ${inps.DisableNoJekyll}`);
|
[INFO] TagName: ${inps.TagName}
|
||||||
core.info(`[INFO] CNAME: ${inps.CNAME}`);
|
[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'),
|
||||||
@@ -44,12 +63,9 @@ export function getInputs(): Inputs {
|
|||||||
CommitMessage: core.getInput('commit_message'),
|
CommitMessage: core.getInput('commit_message'),
|
||||||
TagName: core.getInput('tag_name'),
|
TagName: core.getInput('tag_name'),
|
||||||
TagMessage: core.getInput('tag_message'),
|
TagMessage: core.getInput('tag_message'),
|
||||||
DisableNoJekyll:
|
DisableNoJekyll: useBuiltinJekyll,
|
||||||
(core.getInput('disable_nojekyll') || 'false').toUpperCase() === 'TRUE',
|
|
||||||
CNAME: core.getInput('cname')
|
CNAME: core.getInput('cname')
|
||||||
};
|
};
|
||||||
|
|
||||||
showInputs(inps);
|
|
||||||
|
|
||||||
return inps;
|
return inps;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export async function setRepo(
|
|||||||
core.info(
|
core.info(
|
||||||
`[INFO] first deployment, create new branch ${inps.PublishBranch}`
|
`[INFO] first deployment, create new branch ${inps.PublishBranch}`
|
||||||
);
|
);
|
||||||
core.info(e);
|
core.info(e.message);
|
||||||
await createWorkDir(workDir);
|
await createWorkDir(workDir);
|
||||||
process.chdir(workDir);
|
process.chdir(workDir);
|
||||||
await createBranchForce(inps.PublishBranch);
|
await createBranchForce(inps.PublishBranch);
|
||||||
@@ -103,29 +103,34 @@ export async function setRepo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setConfig(
|
export function getUserName(userName: string): string {
|
||||||
|
if (userName) {
|
||||||
|
return userName;
|
||||||
|
} else {
|
||||||
|
return `${process.env.GITHUB_ACTOR}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getUserEmail(userEmail: string): string {
|
||||||
|
if (userEmail) {
|
||||||
|
return userEmail;
|
||||||
|
} else {
|
||||||
|
return `${process.env.GITHUB_ACTOR}@users.noreply.github.com`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function setCommitAuthor(
|
||||||
userName: string,
|
userName: string,
|
||||||
userEmail: string
|
userEmail: string
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
await exec.exec('git', ['config', '--global', 'gc.auto', '0']);
|
if (userName && !userEmail) {
|
||||||
|
throw new Error('user_email is undefined');
|
||||||
let name = '';
|
|
||||||
if (userName) {
|
|
||||||
name = userName;
|
|
||||||
} else {
|
|
||||||
name = `${process.env.GITHUB_ACTOR}`;
|
|
||||||
}
|
}
|
||||||
await exec.exec('git', ['config', '--global', 'user.name', name]);
|
if (!userName && userEmail) {
|
||||||
|
throw new Error('user_name is undefined');
|
||||||
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]);
|
await exec.exec('git', ['config', 'user.name', getUserName(userName)]);
|
||||||
|
await exec.exec('git', ['config', 'user.email', getUserEmail(userEmail)]);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function commit(
|
export async function commit(
|
||||||
@@ -156,7 +161,7 @@ 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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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}"`);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
37
src/main.ts
@@ -1,16 +1,31 @@
|
|||||||
|
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 {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, commit, push, pushTag} from './git-utils';
|
||||||
import {getWorkDirName, addNoJekyll, addCNAME} from './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();
|
||||||
|
showInputs(inps);
|
||||||
|
|
||||||
await git.setConfig(inps.UserName, inps.UserEmail);
|
// 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'
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const remoteURL = await setTokens(inps);
|
const remoteURL = await setTokens(inps);
|
||||||
core.debug(`[INFO] remoteURL: ${remoteURL}`);
|
core.debug(`[INFO] remoteURL: ${remoteURL}`);
|
||||||
@@ -18,7 +33,7 @@ export async function run(): Promise<void> {
|
|||||||
const date = new Date();
|
const date = new Date();
|
||||||
const unixTime = date.getTime();
|
const unixTime = date.getTime();
|
||||||
const workDir = await getWorkDirName(`${unixTime}`);
|
const workDir = await getWorkDirName(`${unixTime}`);
|
||||||
await git.setRepo(inps, remoteURL, workDir);
|
await setRepo(inps, remoteURL, workDir);
|
||||||
|
|
||||||
await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
|
await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
|
||||||
await addCNAME(workDir, inps.CNAME);
|
await addCNAME(workDir, inps.CNAME);
|
||||||
@@ -26,23 +41,23 @@ export async function run(): Promise<void> {
|
|||||||
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);
|
||||||
await git.commit(
|
await commit(
|
||||||
inps.AllowEmptyCommit,
|
inps.AllowEmptyCommit,
|
||||||
inps.ExternalRepository,
|
inps.ExternalRepository,
|
||||||
inps.CommitMessage
|
inps.CommitMessage
|
||||||
);
|
);
|
||||||
await git.push(inps.PublishBranch, inps.ForceOrphan);
|
await push(inps.PublishBranch, inps.ForceOrphan);
|
||||||
await git.pushTag(inps.TagName, inps.TagMessage);
|
await pushTag(inps.TagName, inps.TagMessage);
|
||||||
|
|
||||||
core.info('[INFO] Action successfully completed');
|
core.info('[INFO] Action successfully completed');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(e);
|
throw new Error(e.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,6 @@ const cpexec = require('child_process').execFileSync;
|
|||||||
import {Inputs} from './interfaces';
|
import {Inputs} from './interfaces';
|
||||||
import {getHomeDir} from './utils';
|
import {getHomeDir} from './utils';
|
||||||
|
|
||||||
export function setPublishRepo(insp: Inputs): string {
|
|
||||||
if (insp.ExternalRepository) {
|
|
||||||
return insp.ExternalRepository;
|
|
||||||
}
|
|
||||||
return `${github.context.repo.owner}/${github.context.repo.repo}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function setSSHKey(
|
export async function setSSHKey(
|
||||||
inps: Inputs,
|
inps: Inputs,
|
||||||
publishRepo: string
|
publishRepo: string
|
||||||
@@ -66,57 +59,82 @@ 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}`);
|
||||||
core.debug(`ref: ${context.ref}`);
|
core.debug(`eventName: ${eventName}`);
|
||||||
core.debug(`eventName: ${context.eventName}`);
|
|
||||||
let isProhibitedBranch = false;
|
let isProhibitedBranch = false;
|
||||||
|
|
||||||
const ref = context.ref;
|
if (eventName === 'push') {
|
||||||
if (context.eventName === 'push') {
|
isProhibitedBranch = ref.includes(`refs/heads/${publishBranch}`);
|
||||||
isProhibitedBranch = ref.includes(`refs/heads/${inps.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}`
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inps.ExternalRepository) {
|
if (externalRepository) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'GITHUB_TOKEN does not support to push to an external repository'
|
'GITHUB_TOKEN does not support to push to an external repository'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return `https://x-access-token:${inps.GithubToken}@github.com/${publishRepo}.git`;
|
return `https://x-access-token:${githubToken}@github.com/${publishRepo}.git`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setPersonalToken(
|
export function setPersonalToken(
|
||||||
inps: Inputs,
|
personalToken: string,
|
||||||
publishRepo: string
|
publishRepo: string
|
||||||
): Promise<string> {
|
): 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
15
src/utils.ts
@@ -62,3 +62,18 @@ export async function addCNAME(
|
|||||||
fs.writeFileSync(filepath, content + '\n');
|
fs.writeFileSync(filepath, content + '\n');
|
||||||
core.info(`[INFO] Created ${filepath}`);
|
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;
|
||||||
|
}
|
||||||
|
|||||||