Compare commits
181 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
476e697393 | ||
|
|
07d4ccdcfe | ||
|
|
44bdada02c | ||
|
|
4377a42d7a | ||
|
|
ee834289d5 | ||
|
|
a9077f3fa3 | ||
|
|
72f58a06cf | ||
|
|
a8a9c90a27 | ||
|
|
ee6484961d | ||
|
|
a8f525053d | ||
|
|
6f9a5b7a66 | ||
|
|
5c097c0f86 | ||
|
|
0f6166f02c | ||
|
|
2712ed55b1 | ||
|
|
01976c9d9b | ||
|
|
78a39ce0df | ||
|
|
90a40adfe5 | ||
|
|
d3e35b292a | ||
|
|
c97a39a35f | ||
|
|
9df954b37b | ||
|
|
dea6ee7419 | ||
|
|
2ca4395141 | ||
|
|
6546aa9608 | ||
|
|
a60eec20ec | ||
|
|
21536c05d5 | ||
|
|
3a443e3a0a | ||
|
|
c320668126 | ||
|
|
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 | ||
|
|
db6bfb8f36 | ||
|
|
22c1c9babc | ||
|
|
68b21c12af | ||
|
|
28b05fd3fa | ||
|
|
bacf0a61ea | ||
|
|
2573b6139b | ||
|
|
96360d5a85 | ||
|
|
14069e75e2 | ||
|
|
d3edcde28b | ||
|
|
d82725c632 | ||
|
|
e504bd5c38 |
@@ -1,10 +1,9 @@
|
||||
version: 1
|
||||
update_configs:
|
||||
- package_manager: "docker"
|
||||
- package_manager: "javascript"
|
||||
directory: "/"
|
||||
update_schedule: "weekly"
|
||||
update_schedule: "daily"
|
||||
default_labels:
|
||||
- "dependencies"
|
||||
- "docker"
|
||||
commit_message:
|
||||
prefix: "deps"
|
||||
|
||||
@@ -1,7 +1,2 @@
|
||||
.git
|
||||
.github
|
||||
.hadolint.yaml
|
||||
LICENSE
|
||||
README.md
|
||||
action.yml
|
||||
images
|
||||
.*
|
||||
*
|
||||
|
||||
13
.editorconfig
Normal file
@@ -0,0 +1,13 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[Makefile]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
24
.eslintrc.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"env": {
|
||||
"commonjs": true,
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:jest/recommended"
|
||||
],
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 2019
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
}
|
||||
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: 'Bug: This is a sample issue title'
|
||||
title: 'sample_title'
|
||||
labels: bug
|
||||
assignees: peaceiris
|
||||
|
||||
|
||||
7
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -3,6 +3,9 @@ contact_links:
|
||||
- name: GitHub Actions Community Forum
|
||||
url: https://github.community/t5/GitHub-Actions/bd-p/actions
|
||||
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
|
||||
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
|
||||
about: Suggest an idea for this project
|
||||
title: 'proposal: This is a sample title'
|
||||
title: 'sample_title'
|
||||
labels: proposal
|
||||
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.
|
||||
40
.github/workflows/docker-image-ci.yml
vendored
@@ -1,40 +0,0 @@
|
||||
name: docker image ci
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: build
|
||||
env:
|
||||
DOCKER_IMAGE: docker.pkg.github.com/${{ github.repository }}/action:latest
|
||||
run: |
|
||||
docker build . --file Dockerfile --tag ${DOCKER_IMAGE}
|
||||
|
||||
shellcheck:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: shellcheck
|
||||
run: shellcheck ./entrypoint.sh
|
||||
|
||||
hadolint:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: brew install hadolint
|
||||
- run: hadolint ./Dockerfile
|
||||
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
|
||||
36
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v3.*.*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Dump GitHub context
|
||||
env:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "${GITHUB_CONTEXT}"
|
||||
|
||||
- name: Install github/hub
|
||||
run: |
|
||||
export HUB_VERSION="2.14.2"
|
||||
curl -fsSL https://github.com/github/hub/raw/8d91904208171b013f9a9d1175f4ab39068db047/script/get | bash -s "${HUB_VERSION}"
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
TAG_NAME="${GITHUB_REF##refs/tags/}"
|
||||
echo "See [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG_NAME}/CHANGELOG.md) for more details." > ./release_notes.md
|
||||
RELEASE_NAME="$(jq -r '.name' ./package.json)"
|
||||
sed -i "1i${RELEASE_NAME} ${TAG_NAME}\n" ./release_notes.md
|
||||
./bin/hub release create \
|
||||
--draft \
|
||||
--prerelease \
|
||||
--file ./release_notes.md \
|
||||
"${TAG_NAME}"
|
||||
16
.github/workflows/stale.yml
vendored
@@ -2,16 +2,16 @@ name: "Stale"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "6 6 * * *"
|
||||
- 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
|
||||
- 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
|
||||
|
||||
113
.github/workflows/test-action.yml
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
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:
|
||||
max-parallel: 1
|
||||
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 i -g npm
|
||||
|
||||
- name: Dump version
|
||||
run: |
|
||||
node -v
|
||||
npm --version
|
||||
git --version
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Remove lint-staged husky
|
||||
run: |
|
||||
npm uninstall lint-staged husky
|
||||
git checkout package-lock.json package.json
|
||||
|
||||
- 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
|
||||
if: matrix.os != 'windows-latest'
|
||||
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 }}
|
||||
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
|
||||
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
|
||||
|
||||
- name: Deploy
|
||||
if: matrix.os == 'windows-latest'
|
||||
uses: ./
|
||||
with:
|
||||
# deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# personal_token: ${{ secrets.PERSONAL_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: 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 }}'
|
||||
75
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
name: 'Test'
|
||||
|
||||
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 i -g npm
|
||||
|
||||
- name: Dump version
|
||||
run: |
|
||||
node -v
|
||||
npm --version
|
||||
git --version
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Run prettier
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: npm run format:check
|
||||
|
||||
- name: Run eslint
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: npm run lint
|
||||
|
||||
- name: Run ncc
|
||||
if: startsWith(matrix.os, 'ubuntu')
|
||||
run: npm run build
|
||||
|
||||
- run: npm test
|
||||
|
||||
- name: Upload test coverage as artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: coverage
|
||||
path: coverage
|
||||
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
5
.github/workflows/update-major-tag.yml
vendored
@@ -19,6 +19,5 @@ jobs:
|
||||
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
|
||||
export TAG_NAME="${GITHUB_REF##refs/tags/}"
|
||||
export TAG_MAJOR="${TAG_NAME%%.*}"
|
||||
git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || git tag -d "${TAG_MAJOR}" ; git push --delete origin "${TAG_MAJOR}"
|
||||
git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || true
|
||||
git push origin "${TAG_MAJOR}"
|
||||
git tag --force -a "${TAG_MAJOR}" -m "Release ${TAG_NAME}"
|
||||
git push --force origin "${TAG_MAJOR}"
|
||||
|
||||
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
.DS_Store
|
||||
coverage
|
||||
.npm
|
||||
.eslintcache
|
||||
.env
|
||||
node_modules
|
||||
@@ -1,2 +0,0 @@
|
||||
ignored:
|
||||
- DL3018
|
||||
11
.prettierrc.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"parser": "typescript"
|
||||
}
|
||||
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
||||
450
CHANGELOG.md
Normal file
@@ -0,0 +1,450 @@
|
||||
# Changelog
|
||||
|
||||
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-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)
|
||||
|
||||
|
||||
### deps
|
||||
|
||||
* bump eslint-plugin-jest from 23.7.0 to 23.8.0 (#124) ([e0af1f7](https://github.com/peaceiris/actions-gh-pages/commit/e0af1f7de04642a5e810c38b24abd507d81b86be)), closes [#124](https://github.com/peaceiris/actions-gh-pages/issues/124)
|
||||
|
||||
### docs
|
||||
|
||||
* Put github_token as first example (#115) ([62e7849](https://github.com/peaceiris/actions-gh-pages/commit/62e7849d7ab5a2167baf529dc8fd9034fcf41c43)), closes [#115](https://github.com/peaceiris/actions-gh-pages/issues/115)
|
||||
* update ([7b12ca9](https://github.com/peaceiris/actions-gh-pages/commit/7b12ca9aebe1ddcf25dc1c6fd793308e703b4ec7))
|
||||
|
||||
|
||||
|
||||
# [3.3.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.2.0...v3.3.0) (2020-02-24)
|
||||
|
||||
|
||||
### deps
|
||||
|
||||
* bump @actions/github from 2.1.0 to 2.1.1 (#120) ([5d3cd50](https://github.com/peaceiris/actions-gh-pages/commit/5d3cd509d9e8ab8ba8b6c6981eb8ecb077ab2109)), closes [#120](https://github.com/peaceiris/actions-gh-pages/issues/120)
|
||||
* bump @types/jest from 25.1.2 to 25.1.3 (#118) ([0b1dd44](https://github.com/peaceiris/actions-gh-pages/commit/0b1dd44709acc2ba27cf43e181767b92e78d1577)), closes [#118](https://github.com/peaceiris/actions-gh-pages/issues/118)
|
||||
* bump @types/node from 12.12.27 to 12.12.28 (#122) ([b243caf](https://github.com/peaceiris/actions-gh-pages/commit/b243cafb6e6598d71925399552d569a628a42aa7)), closes [#122](https://github.com/peaceiris/actions-gh-pages/issues/122)
|
||||
* bump @zeit/ncc from 0.21.0 to 0.21.1 (#101) ([6244b19](https://github.com/peaceiris/actions-gh-pages/commit/6244b197b6c5a57172d87769cd03d79cedae9dca)), closes [#101](https://github.com/peaceiris/actions-gh-pages/issues/101)
|
||||
* bump ts-jest from 25.2.0 to 25.2.1 (#117) ([e1bf32a](https://github.com/peaceiris/actions-gh-pages/commit/e1bf32ad68fadb9a32147579d6dc49b51d6ddefb)), closes [#117](https://github.com/peaceiris/actions-gh-pages/issues/117)
|
||||
* bump typescript from 3.7.5 to 3.8.2 (#121) ([e58a6c1](https://github.com/peaceiris/actions-gh-pages/commit/e58a6c156e7249d4e6052539e2ed0aa449bdd4f4)), closes [#121](https://github.com/peaceiris/actions-gh-pages/issues/121)
|
||||
|
||||
### feat
|
||||
|
||||
* Add disable_nojekyll and cname options (#119) ([00fde1e](https://github.com/peaceiris/actions-gh-pages/commit/00fde1eb97e54d4fa89f31806ff2815878fafcb6)), closes [#119](https://github.com/peaceiris/actions-gh-pages/issues/119) [/github.com/peaceiris/actions-gh-pages/issues/112#issuecomment-589678269](https://github.com//github.com/peaceiris/actions-gh-pages/issues/112/issues/issuecomment-589678269) [#112](https://github.com/peaceiris/actions-gh-pages/issues/112)
|
||||
|
||||
|
||||
|
||||
# [3.3.0-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.2.0...v3.3.0-0) (2020-02-20)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* Add vim ([b9a6975](https://github.com/peaceiris/actions-gh-pages/commit/b9a697582713e95c1d628172933226631d3825af))
|
||||
|
||||
### deps
|
||||
|
||||
* bump @types/jest from 25.1.2 to 25.1.3 (#118) ([0b1dd44](https://github.com/peaceiris/actions-gh-pages/commit/0b1dd44709acc2ba27cf43e181767b92e78d1577)), closes [#118](https://github.com/peaceiris/actions-gh-pages/issues/118)
|
||||
* bump ts-jest from 25.2.0 to 25.2.1 (#117) ([e1bf32a](https://github.com/peaceiris/actions-gh-pages/commit/e1bf32ad68fadb9a32147579d6dc49b51d6ddefb)), closes [#117](https://github.com/peaceiris/actions-gh-pages/issues/117)
|
||||
|
||||
### feat
|
||||
|
||||
* Add disable_nojekyll and cname options ([7c4b591](https://github.com/peaceiris/actions-gh-pages/commit/7c4b591cf65cf4daf0464fba89b32ff4e764b427)), closes [#112](https://github.com/peaceiris/actions-gh-pages/issues/112)
|
||||
|
||||
|
||||
|
||||
# [3.2.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.1.0...v3.2.0) (2020-02-19)
|
||||
|
||||
|
||||
### feat
|
||||
|
||||
* Remove warning about GITHUB_TOKEN (#108) ([74f652a](https://github.com/peaceiris/actions-gh-pages/commit/74f652acfdfc3290f8b6f7c5e65fd1f563412cf5)), closes [#108](https://github.com/peaceiris/actions-gh-pages/issues/108) [#9](https://github.com/peaceiris/actions-gh-pages/issues/9)
|
||||
|
||||
|
||||
|
||||
# [3.1.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.3...v3.1.0) (2020-02-19)
|
||||
|
||||
|
||||
### deps
|
||||
|
||||
* bump @types/jest from 25.1.1 to 25.1.2 (#93) ([aec195e](https://github.com/peaceiris/actions-gh-pages/commit/aec195ebb4e984f62f48139a5e24aa85ea31e891)), closes [#93](https://github.com/peaceiris/actions-gh-pages/issues/93)
|
||||
* bump @types/node from 13.7.0 to 13.7.1 (#99) ([0b00dd2](https://github.com/peaceiris/actions-gh-pages/commit/0b00dd2a9f91c1854f4b1cfe68dc30891ebccc9f)), closes [#99](https://github.com/peaceiris/actions-gh-pages/issues/99)
|
||||
* bump @types/node from 13.7.1 to 13.7.2 (#110) ([591c4bd](https://github.com/peaceiris/actions-gh-pages/commit/591c4bdf2ee1c6aa5f1958c4553902feac06dcfe)), closes [#110](https://github.com/peaceiris/actions-gh-pages/issues/110)
|
||||
* bump @typescript-eslint/eslint-plugin from 2.19.0 to 2.19.2 (#97) ([5d5e933](https://github.com/peaceiris/actions-gh-pages/commit/5d5e9338ccbca63f80f5ee66ba9e9eff14bacb68)), closes [#97](https://github.com/peaceiris/actions-gh-pages/issues/97)
|
||||
* bump @typescript-eslint/eslint-plugin from 2.19.2 to 2.20.0 (#105) ([1c50baa](https://github.com/peaceiris/actions-gh-pages/commit/1c50baa294d259f81459f7a495f8d0d2a50a1b6d)), closes [#105](https://github.com/peaceiris/actions-gh-pages/issues/105)
|
||||
* bump @typescript-eslint/parser from 2.19.0 to 2.19.2 (#96) ([8b52b41](https://github.com/peaceiris/actions-gh-pages/commit/8b52b41ecb191f50bd5efc9ee2c0266a2d171d14)), closes [#96](https://github.com/peaceiris/actions-gh-pages/issues/96)
|
||||
* bump @typescript-eslint/parser from 2.19.2 to 2.20.0 (#106) ([73c09c7](https://github.com/peaceiris/actions-gh-pages/commit/73c09c703e63c0b442ffa50624ace10eaa929280)), closes [#106](https://github.com/peaceiris/actions-gh-pages/issues/106)
|
||||
* bump eslint-plugin-jest from 23.6.0 to 23.7.0 (#95) ([0a1a581](https://github.com/peaceiris/actions-gh-pages/commit/0a1a58196ba5bf48e168475e0ac3898fbd3043e2)), closes [#95](https://github.com/peaceiris/actions-gh-pages/issues/95)
|
||||
* bump husky from 4.2.1 to 4.2.3 (#102) ([49a6939](https://github.com/peaceiris/actions-gh-pages/commit/49a6939dbb77d7656228cdc3bed6a99d5124a6b2)), closes [#102](https://github.com/peaceiris/actions-gh-pages/issues/102)
|
||||
* bump node from 12.14.1 to 12.15.0 (#94) ([0e542f9](https://github.com/peaceiris/actions-gh-pages/commit/0e542f9f9231c005e1a6363a33a69fdbde436085)), closes [#94](https://github.com/peaceiris/actions-gh-pages/issues/94)
|
||||
* Rollback @types/node 13 to 12 (#111) ([195ab80](https://github.com/peaceiris/actions-gh-pages/commit/195ab8005d4af142c40fd8e53a59783b697d75d9)), closes [#111](https://github.com/peaceiris/actions-gh-pages/issues/111)
|
||||
|
||||
### docs
|
||||
|
||||
* fix ([60c31d2](https://github.com/peaceiris/actions-gh-pages/commit/60c31d23a8a096624a3b9a0955a05ea9941dc140))
|
||||
* rename author to Maintainer ([4101589](https://github.com/peaceiris/actions-gh-pages/commit/41015898aad0abad9d0760bc576e4748e476d4f9))
|
||||
* update job name ([752214a](https://github.com/peaceiris/actions-gh-pages/commit/752214aa33756f6e097f908671681a13865a9991))
|
||||
* update publish_branch for v3 ([a7866b5](https://github.com/peaceiris/actions-gh-pages/commit/a7866b5bd3a121a460c8c39cb1c9d1586db6b231))
|
||||
* update status of github_token ([1887981](https://github.com/peaceiris/actions-gh-pages/commit/1887981f72e59b54f68febb4fa4786e7e153ef6d))
|
||||
|
||||
### fix
|
||||
|
||||
* Change final message ([476fa94](https://github.com/peaceiris/actions-gh-pages/commit/476fa94197aea4d3f74e5619ae77ebf966fd5fff))
|
||||
* Use onetime workdir name (#109) ([2f5ccc9](https://github.com/peaceiris/actions-gh-pages/commit/2f5ccc92dfcf8e85d9d3c19dc842a440380253bf)), closes [#109](https://github.com/peaceiris/actions-gh-pages/issues/109)
|
||||
|
||||
### refactor
|
||||
|
||||
* fix typo and remove useless function (#107) ([55a68e3](https://github.com/peaceiris/actions-gh-pages/commit/55a68e34ca406d99b5b2a4549d7ade5eeb03d860)), closes [#107](https://github.com/peaceiris/actions-gh-pages/issues/107)
|
||||
|
||||
|
||||
|
||||
## [3.0.4-1](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.4-0...v3.0.4-1) (2020-02-19)
|
||||
|
||||
|
||||
### deps
|
||||
|
||||
* bump @types/node from 13.7.1 to 13.7.2 (#110) ([591c4bd](https://github.com/peaceiris/actions-gh-pages/commit/591c4bdf2ee1c6aa5f1958c4553902feac06dcfe)), closes [#110](https://github.com/peaceiris/actions-gh-pages/issues/110)
|
||||
* Rollback @types/node 13 to 12 (#111) ([195ab80](https://github.com/peaceiris/actions-gh-pages/commit/195ab8005d4af142c40fd8e53a59783b697d75d9)), closes [#111](https://github.com/peaceiris/actions-gh-pages/issues/111)
|
||||
|
||||
### fix
|
||||
|
||||
* Add await ([0031179](https://github.com/peaceiris/actions-gh-pages/commit/00311793aa104bf99501373756461475b6752f16))
|
||||
* convert to string ([cbe4d56](https://github.com/peaceiris/actions-gh-pages/commit/cbe4d56fb8bd50d63919f783483f74c694a3dd9b))
|
||||
* use onetime workdir name ([0d912a1](https://github.com/peaceiris/actions-gh-pages/commit/0d912a1314ce9d77f29bc0c1fada559223dd5563))
|
||||
|
||||
### refactor
|
||||
|
||||
* Add info message ([8e6c12a](https://github.com/peaceiris/actions-gh-pages/commit/8e6c12a2b5f973c8736f831398d0fe7c980f1431))
|
||||
|
||||
|
||||
|
||||
## [3.0.4-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.3...v3.0.4-0) (2020-02-18)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* Allow to release from not master ([3c7cd58](https://github.com/peaceiris/actions-gh-pages/commit/3c7cd587e403a76d6725a0e84796cf12a59752f3))
|
||||
|
||||
### deps
|
||||
|
||||
* bump @types/jest from 25.1.1 to 25.1.2 (#93) ([aec195e](https://github.com/peaceiris/actions-gh-pages/commit/aec195ebb4e984f62f48139a5e24aa85ea31e891)), closes [#93](https://github.com/peaceiris/actions-gh-pages/issues/93)
|
||||
* bump @types/node from 13.7.0 to 13.7.1 (#99) ([0b00dd2](https://github.com/peaceiris/actions-gh-pages/commit/0b00dd2a9f91c1854f4b1cfe68dc30891ebccc9f)), closes [#99](https://github.com/peaceiris/actions-gh-pages/issues/99)
|
||||
* bump @typescript-eslint/eslint-plugin from 2.19.0 to 2.19.2 (#97) ([5d5e933](https://github.com/peaceiris/actions-gh-pages/commit/5d5e9338ccbca63f80f5ee66ba9e9eff14bacb68)), closes [#97](https://github.com/peaceiris/actions-gh-pages/issues/97)
|
||||
* bump @typescript-eslint/eslint-plugin from 2.19.2 to 2.20.0 (#105) ([1c50baa](https://github.com/peaceiris/actions-gh-pages/commit/1c50baa294d259f81459f7a495f8d0d2a50a1b6d)), closes [#105](https://github.com/peaceiris/actions-gh-pages/issues/105)
|
||||
* bump @typescript-eslint/parser from 2.19.0 to 2.19.2 (#96) ([8b52b41](https://github.com/peaceiris/actions-gh-pages/commit/8b52b41ecb191f50bd5efc9ee2c0266a2d171d14)), closes [#96](https://github.com/peaceiris/actions-gh-pages/issues/96)
|
||||
* bump @typescript-eslint/parser from 2.19.2 to 2.20.0 (#106) ([73c09c7](https://github.com/peaceiris/actions-gh-pages/commit/73c09c703e63c0b442ffa50624ace10eaa929280)), closes [#106](https://github.com/peaceiris/actions-gh-pages/issues/106)
|
||||
* bump eslint-plugin-jest from 23.6.0 to 23.7.0 (#95) ([0a1a581](https://github.com/peaceiris/actions-gh-pages/commit/0a1a58196ba5bf48e168475e0ac3898fbd3043e2)), closes [#95](https://github.com/peaceiris/actions-gh-pages/issues/95)
|
||||
* bump husky from 4.2.1 to 4.2.3 (#102) ([49a6939](https://github.com/peaceiris/actions-gh-pages/commit/49a6939dbb77d7656228cdc3bed6a99d5124a6b2)), closes [#102](https://github.com/peaceiris/actions-gh-pages/issues/102)
|
||||
* bump node from 12.14.1 to 12.15.0 (#94) ([0e542f9](https://github.com/peaceiris/actions-gh-pages/commit/0e542f9f9231c005e1a6363a33a69fdbde436085)), closes [#94](https://github.com/peaceiris/actions-gh-pages/issues/94)
|
||||
|
||||
### docs
|
||||
|
||||
* fix ([60c31d2](https://github.com/peaceiris/actions-gh-pages/commit/60c31d23a8a096624a3b9a0955a05ea9941dc140))
|
||||
* rename author to Maintainer ([4101589](https://github.com/peaceiris/actions-gh-pages/commit/41015898aad0abad9d0760bc576e4748e476d4f9))
|
||||
* update job name ([752214a](https://github.com/peaceiris/actions-gh-pages/commit/752214aa33756f6e097f908671681a13865a9991))
|
||||
* update publish_branch for v3 ([a7866b5](https://github.com/peaceiris/actions-gh-pages/commit/a7866b5bd3a121a460c8c39cb1c9d1586db6b231))
|
||||
* update status of github_token ([1887981](https://github.com/peaceiris/actions-gh-pages/commit/1887981f72e59b54f68febb4fa4786e7e153ef6d))
|
||||
|
||||
### fix
|
||||
|
||||
* Add removing workDir at the end ([5ba5849](https://github.com/peaceiris/actions-gh-pages/commit/5ba5849ab229d5b6eecc1d13de82e71999961cdc))
|
||||
* Change final message ([476fa94](https://github.com/peaceiris/actions-gh-pages/commit/476fa94197aea4d3f74e5619ae77ebf966fd5fff))
|
||||
* tag fetching ([6595e02](https://github.com/peaceiris/actions-gh-pages/commit/6595e02d683d6ca8275d76e2818662da80ac685a))
|
||||
* tag fetching ([6fe5c9e](https://github.com/peaceiris/actions-gh-pages/commit/6fe5c9e76213b6d5bc542be649cbe0289e947ab6))
|
||||
|
||||
### refactor
|
||||
|
||||
* fix typo and remove useless function (#107) ([55a68e3](https://github.com/peaceiris/actions-gh-pages/commit/55a68e34ca406d99b5b2a4549d7ade5eeb03d860)), closes [#107](https://github.com/peaceiris/actions-gh-pages/issues/107)
|
||||
|
||||
|
||||
|
||||
## [3.0.3](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.3-0...v3.0.3) (2020-02-06)
|
||||
|
||||
|
||||
### docs
|
||||
|
||||
* update example of publish_branch ([2948e5e](https://github.com/peaceiris/actions-gh-pages/commit/2948e5eda85d99ffc20cda677353918ea9ea3f45))
|
||||
|
||||
|
||||
|
||||
## [3.0.3-0](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.2...v3.0.3-0) (2020-02-06)
|
||||
|
||||
|
||||
### fix
|
||||
|
||||
* Enable to create branch for first deployment (#92) ([1b6740c](https://github.com/peaceiris/actions-gh-pages/commit/1b6740cb30fc6a5a695a015144589862eb241b7d)), closes [#92](https://github.com/peaceiris/actions-gh-pages/issues/92)
|
||||
|
||||
|
||||
|
||||
## [3.0.2](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.1...v3.0.2) (2020-02-05)
|
||||
|
||||
|
||||
### ci
|
||||
|
||||
* use github_token for windows-latest ([cfdf8c4](https://github.com/peaceiris/actions-gh-pages/commit/cfdf8c43ed170ce3bcfc1b4ee5ba50000e89f9e7))
|
||||
|
||||
### docs
|
||||
|
||||
* Add CodeFactor badge ([0ba5bf3](https://github.com/peaceiris/actions-gh-pages/commit/0ba5bf3eeb5f0ad9e42dc6344afa736b47dac67f))
|
||||
* Add Supported Platforms table ([f0177d1](https://github.com/peaceiris/actions-gh-pages/commit/f0177d176f9464c11cbdff5a68dbecd6e630e371))
|
||||
* update log example for v3 ([d35854b](https://github.com/peaceiris/actions-gh-pages/commit/d35854bdf87ba4311c5b5ba738260e4eb89c2295))
|
||||
|
||||
### fix
|
||||
|
||||
* add debug ([fb54d6a](https://github.com/peaceiris/actions-gh-pages/commit/fb54d6af4d2abbf7a42806620594b173c2f55882))
|
||||
* add filePath ([f8b5a36](https://github.com/peaceiris/actions-gh-pages/commit/f8b5a36401de48c3bf2fda47a51b010350405163))
|
||||
* copy directories #89 ([6edc4c9](https://github.com/peaceiris/actions-gh-pages/commit/6edc4c976449147551137b19eb7bc092d9d129ec)), closes [#89](https://github.com/peaceiris/actions-gh-pages/issues/89)
|
||||
* copy force ([848165c](https://github.com/peaceiris/actions-gh-pages/commit/848165cf9f01c61b1f2e83d433177a9f46ce5ea7))
|
||||
|
||||
|
||||
|
||||
## [3.0.1](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.0...v3.0.1) (2020-02-05)
|
||||
|
||||
|
||||
### docs
|
||||
|
||||
* Add link to v2 ([ec95e8e](https://github.com/peaceiris/actions-gh-pages/commit/ec95e8e7aae2075200c33461a0f3aa640d7fbe02))
|
||||
* remove Script mode section ([9b3fcdf](https://github.com/peaceiris/actions-gh-pages/commit/9b3fcdf51572449ce5f346724d01e878bd811834))
|
||||
* remove v2 example ([a1375a4](https://github.com/peaceiris/actions-gh-pages/commit/a1375a463794f123e06ddb6af0d74ef453d74fa0))
|
||||
* update ([1a26eac](https://github.com/peaceiris/actions-gh-pages/commit/1a26eaca33cf4f1d162fc37fd45cab6ea999140e))
|
||||
* update for v3 ([1a13108](https://github.com/peaceiris/actions-gh-pages/commit/1a1310886515195d8b9052e68aec5a973dd3779d))
|
||||
* update for v3 ([d0de38a](https://github.com/peaceiris/actions-gh-pages/commit/d0de38a352de7896c0bc618c3977f00f6a34151d))
|
||||
* update for v3 ([b3cfcb1](https://github.com/peaceiris/actions-gh-pages/commit/b3cfcb13c0e3d5b76fb2b306fafbc0bfdc349e2e))
|
||||
* update for v3 ([b1aaa85](https://github.com/peaceiris/actions-gh-pages/commit/b1aaa85b6766b71fd96a06d1ea8a99a5247e7b6c))
|
||||
* update for v3 ([f1e7cd6](https://github.com/peaceiris/actions-gh-pages/commit/f1e7cd608c631ec6a3c48e1e76f17b6c8a468ada))
|
||||
* update for v3 ([07a3f29](https://github.com/peaceiris/actions-gh-pages/commit/07a3f2915ef742feb191caf4315f92c5dbe24657))
|
||||
* update for v3 ([02c3858](https://github.com/peaceiris/actions-gh-pages/commit/02c38586a5b45e217af006473aa99749917bce73))
|
||||
* update for v3 ([59bbb98](https://github.com/peaceiris/actions-gh-pages/commit/59bbb98387fa6cde2495176555efd39a3c68b6b5))
|
||||
* update for v3 ([be27dcc](https://github.com/peaceiris/actions-gh-pages/commit/be27dcce4894bf0847e64b2ba676b9de08979d21))
|
||||
* update for v3 ([ccf71d1](https://github.com/peaceiris/actions-gh-pages/commit/ccf71d1162ce030d5f8aa4bb1e05c45d83912c67))
|
||||
* update for v3 ([5fe4aa3](https://github.com/peaceiris/actions-gh-pages/commit/5fe4aa3f24fd2a3f7cf683b04c29895c6882c5de))
|
||||
* update for v3 ([428902c](https://github.com/peaceiris/actions-gh-pages/commit/428902c6cd381168d113898fa3fd53e83ca658b2))
|
||||
* update for v3 ([00bca7b](https://github.com/peaceiris/actions-gh-pages/commit/00bca7b88cea3a6aff0cd9e90cc297f90981dfe8))
|
||||
* update GitHub Actions badge ([9cec798](https://github.com/peaceiris/actions-gh-pages/commit/9cec79845182679864d2e9f2b137c1829773b4a0))
|
||||
* update overview ([c940278](https://github.com/peaceiris/actions-gh-pages/commit/c940278a4c780afbd658b4a3f0f7834039913401))
|
||||
|
||||
### feat
|
||||
|
||||
* Add getHomeDir() for windows (#86) ([ed21b6a](https://github.com/peaceiris/actions-gh-pages/commit/ed21b6a5942b1be9f75103a2661d908d41ed9ea9)), closes [#86](https://github.com/peaceiris/actions-gh-pages/issues/86)
|
||||
|
||||
### refactor
|
||||
|
||||
* change to core.debug ([9f11da8](https://github.com/peaceiris/actions-gh-pages/commit/9f11da81ae3ead3c8929c35266dd40a0ddfd2bd1))
|
||||
|
||||
|
||||
|
||||
# [3.0.0](https://github.com/peaceiris/actions-gh-pages/compare/v3.0.0-1...v3.0.0) (2020-02-05)
|
||||
|
||||
|
||||
### ci
|
||||
|
||||
* force_orphan to false ([a150e4e](https://github.com/peaceiris/actions-gh-pages/commit/a150e4e690ab9bfcecae05b68c8efd14edac15df))
|
||||
|
||||
### fix
|
||||
|
||||
* action title ([0629bab](https://github.com/peaceiris/actions-gh-pages/commit/0629babb090ceea68f118101b903a8e6798b2962))
|
||||
|
||||
|
||||
|
||||
# [3.0.0-1](https://github.com/peaceiris/actions-gh-pages/compare/v2.10.1...v3.0.0-1) (2020-02-05)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* Change update_schedule from weekly to daily ([d3edcde](https://github.com/peaceiris/actions-gh-pages/commit/d3edcde28b32bdc18b358182c89a7a729facf37c))
|
||||
|
||||
### docs
|
||||
|
||||
* [ImgBot] Optimize images (#81) ([d82725c](https://github.com/peaceiris/actions-gh-pages/commit/d82725c632d7b9dd0fac1981cfaf13d4c550d682)), closes [#81](https://github.com/peaceiris/actions-gh-pages/issues/81)
|
||||
* Add Dart Package peanut for Flutter ([28b05fd](https://github.com/peaceiris/actions-gh-pages/commit/28b05fd3fab1ac4edb3d12ae0cbdc91367279667))
|
||||
* add Dependabot badge ([bacf0a6](https://github.com/peaceiris/actions-gh-pages/commit/bacf0a61ea8e93bcbbbd20089f87f8c12af605e2))
|
||||
* Add release feed badge ([2573b61](https://github.com/peaceiris/actions-gh-pages/commit/2573b6139ba429078ddf457eb170b4af924c55a4))
|
||||
* fix list ([96360d5](https://github.com/peaceiris/actions-gh-pages/commit/96360d5a85f6f54d3fb5175c158179b57a0149cc))
|
||||
* Update OGP image ([e504bd5](https://github.com/peaceiris/actions-gh-pages/commit/e504bd5c3862941f5d03ce8d649329e9d5e105aa))
|
||||
* update support table about GITHUB_TOKEN ([14069e7](https://github.com/peaceiris/actions-gh-pages/commit/14069e75e2e9646aeed42fedb5b99aa31ead3b90))
|
||||
|
||||
### feat
|
||||
|
||||
* Add TypeScript Action (#83) ([68b21c1](https://github.com/peaceiris/actions-gh-pages/commit/68b21c12af25bc606f77a7b5674f162f3a17bf22)), closes [#83](https://github.com/peaceiris/actions-gh-pages/issues/83) [#54](https://github.com/peaceiris/actions-gh-pages/issues/54)
|
||||
37
Dockerfile
@@ -1,10 +1,31 @@
|
||||
FROM alpine:3.11.3
|
||||
ARG NODE_VERSION
|
||||
|
||||
RUN apk add --no-cache \
|
||||
bash \
|
||||
git \
|
||||
openssh-client \
|
||||
ca-certificates
|
||||
FROM node:${NODE_VERSION}-buster-slim
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
SHELL ["/bin/bash", "-l", "-c"]
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev autoconf \
|
||||
ca-certificates \
|
||||
wget \
|
||||
ssh \
|
||||
vim && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
npm i -g npm
|
||||
|
||||
WORKDIR /git
|
||||
ENV GIT_VERSION="2.25.1"
|
||||
RUN wget -q "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz" && \
|
||||
tar -zxf "./v${GIT_VERSION}.tar.gz" && \
|
||||
rm "./v${GIT_VERSION}.tar.gz" && \
|
||||
cd "./git-${GIT_VERSION}" && \
|
||||
make configure && \
|
||||
./configure --prefix=/usr && \
|
||||
make all && \
|
||||
make install
|
||||
|
||||
WORKDIR /repo
|
||||
|
||||
CMD [ "bash" ]
|
||||
|
||||
23
Makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
cmd := "bash"
|
||||
msg := ""
|
||||
IMAGE_NAME := actions_github_pages_dev:latest
|
||||
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)
|
||||
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
$(DOCKER_BUILD)
|
||||
|
||||
.PHONY: run
|
||||
run:
|
||||
$(DOCKER_RUN) $(cmd)
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
$(DOCKER_RUN) npm test
|
||||
|
||||
.PHONY: commit
|
||||
commit:
|
||||
$(DOCKER_RUN) git commit -m "$(msg)"
|
||||
173
__tests__/get-inputs.test.ts
Normal file
@@ -0,0 +1,173 @@
|
||||
// import * as main from '../src/main';
|
||||
import {Inputs} from '../src/interfaces';
|
||||
import {showInputs, getInputs} from '../src/get-inputs';
|
||||
import os from 'os';
|
||||
import fs from 'fs';
|
||||
import yaml from 'js-yaml';
|
||||
|
||||
beforeEach(() => {
|
||||
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(() => {
|
||||
const doc = yaml.safeLoad(
|
||||
fs.readFileSync(__dirname + '/../action.yml', 'utf8')
|
||||
);
|
||||
Object.keys(doc.inputs).forEach(name => {
|
||||
const envVar = `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||
console.debug(`delete ${envVar}\t${process.env[envVar]}`);
|
||||
delete process.env[envVar];
|
||||
});
|
||||
});
|
||||
|
||||
// Assert that process.stdout.write calls called only with the given arguments.
|
||||
// cf. https://github.com/actions/toolkit/blob/8b0300129f08728419263b016de8630f1d426d5f/packages/core/__tests__/core.test.ts
|
||||
function assertWriteCalls(calls: string[]): void {
|
||||
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length);
|
||||
|
||||
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()', () => {
|
||||
test('get default inputs', () => {
|
||||
process.env['INPUT_DEPLOY_KEY'] = 'test_deploy_key';
|
||||
|
||||
const inps: Inputs = getInputs();
|
||||
|
||||
expect(inps.DeployKey).toMatch('test_deploy_key');
|
||||
expect(inps.GithubToken).toMatch('');
|
||||
expect(inps.PersonalToken).toMatch('');
|
||||
expect(inps.PublishBranch).toMatch('gh-pages');
|
||||
expect(inps.PublishDir).toMatch('public');
|
||||
expect(inps.ExternalRepository).toMatch('');
|
||||
expect(inps.AllowEmptyCommit).toBe(false);
|
||||
expect(inps.KeepFiles).toBe(false);
|
||||
expect(inps.ForceOrphan).toBe(false);
|
||||
expect(inps.UserName).toMatch('');
|
||||
expect(inps.UserEmail).toMatch('');
|
||||
expect(inps.CommitMessage).toMatch('');
|
||||
expect(inps.TagName).toMatch('');
|
||||
expect(inps.TagMessage).toMatch('');
|
||||
expect(inps.DisableNoJekyll).toBe(false);
|
||||
expect(inps.CNAME).toMatch('');
|
||||
});
|
||||
|
||||
test('get spec inputs', () => {
|
||||
// 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'] = 'master';
|
||||
process.env['INPUT_PUBLISH_DIR'] = 'out';
|
||||
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';
|
||||
process.env['INPUT_DISABLE_NOJEKYLL'] = 'true';
|
||||
process.env['INPUT_CNAME'] = 'github.com';
|
||||
|
||||
const inps: Inputs = getInputs();
|
||||
|
||||
expect(inps.DeployKey).toMatch('');
|
||||
expect(inps.GithubToken).toMatch('test_github_token');
|
||||
expect(inps.PersonalToken).toMatch('test_personal_token');
|
||||
expect(inps.PublishBranch).toMatch('master');
|
||||
expect(inps.PublishDir).toMatch('out');
|
||||
expect(inps.ExternalRepository).toMatch('user/repo');
|
||||
expect(inps.AllowEmptyCommit).toBe(true);
|
||||
expect(inps.KeepFiles).toBe(true);
|
||||
expect(inps.ForceOrphan).toBe(true);
|
||||
expect(inps.UserName).toMatch('username');
|
||||
expect(inps.UserEmail).toMatch('github@github.com');
|
||||
expect(inps.CommitMessage).toMatch('feat: Add new feature');
|
||||
expect(inps.TagName).toMatch('deploy-v1.2.3');
|
||||
expect(inps.TagMessage).toMatch('Deployment v1.2.3');
|
||||
expect(inps.DisableNoJekyll).toBe(true);
|
||||
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'
|
||||
);
|
||||
});
|
||||
});
|
||||
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);
|
||||
});
|
||||
});
|
||||
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();
|
||||
});
|
||||
});
|
||||
55
action.yml
@@ -2,40 +2,67 @@ name: 'GitHub Pages action'
|
||||
description: 'GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.'
|
||||
author: 'peaceiris'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
using: 'node12'
|
||||
main: 'lib/index.js'
|
||||
branding:
|
||||
icon: 'upload-cloud'
|
||||
color: 'blue'
|
||||
inputs:
|
||||
emptyCommits:
|
||||
deploy_key:
|
||||
description: 'Set a SSH private key from repository secret value for pushing to the remote branch.'
|
||||
required: false
|
||||
github_token:
|
||||
description: 'Set a generated GITHUB_TOKEN for pushing to the remote branch.'
|
||||
required: false
|
||||
personal_token:
|
||||
description: 'Set a personal access token for pushing to the remote branch.'
|
||||
required: false
|
||||
publish_branch:
|
||||
description: 'Set a target branch for deployment.'
|
||||
required: false
|
||||
default: 'gh-pages'
|
||||
publish_dir:
|
||||
description: 'Set an input directory for deployment.'
|
||||
required: false
|
||||
default: 'public'
|
||||
external_repository:
|
||||
description: 'Set an external repository (owner/repo).'
|
||||
required: false
|
||||
allow_empty_commit:
|
||||
description: 'If empty commits should be made to the publication branch'
|
||||
required: false
|
||||
default: 'true'
|
||||
keepFiles:
|
||||
default: 'false'
|
||||
keep_files:
|
||||
description: 'If existing files in the publish branch should be not removed before deploying'
|
||||
required: false
|
||||
default: 'false'
|
||||
forceOrphan:
|
||||
force_orphan:
|
||||
description: 'Keep only the latest commit on a GitHub Pages branch'
|
||||
required: false
|
||||
default: 'false'
|
||||
username:
|
||||
user_name:
|
||||
description: 'Set Git user.name'
|
||||
required: false
|
||||
useremail:
|
||||
user_email:
|
||||
description: 'Set Git user.email'
|
||||
required: false
|
||||
commitMessage:
|
||||
commit_message:
|
||||
description: 'Set custom commit message'
|
||||
required: false
|
||||
tagName:
|
||||
tag_name:
|
||||
description: 'Set tag name'
|
||||
required: false
|
||||
tagMessage:
|
||||
tag_message:
|
||||
description: 'Set tag message'
|
||||
required: false
|
||||
tagOverwrite:
|
||||
description: 'Enable overwriting tag'
|
||||
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
|
||||
default: false
|
||||
|
||||
163
entrypoint.sh
@@ -1,163 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
# set -ex
|
||||
|
||||
function print_error() {
|
||||
echo -e "\e[31mERROR: ${1}\e[m"
|
||||
}
|
||||
|
||||
function print_info() {
|
||||
echo -e "\e[36mINFO: ${1}\e[m"
|
||||
}
|
||||
|
||||
function skip() {
|
||||
print_info "No changes detected, skipping deployment"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# check values
|
||||
if [ -n "${EXTERNAL_REPOSITORY}" ]; then
|
||||
PUBLISH_REPOSITORY=${EXTERNAL_REPOSITORY}
|
||||
else
|
||||
PUBLISH_REPOSITORY=${GITHUB_REPOSITORY}
|
||||
fi
|
||||
print_info "Deploy to ${PUBLISH_REPOSITORY}"
|
||||
|
||||
if [ -n "${ACTIONS_DEPLOY_KEY}" ]; then
|
||||
|
||||
print_info "setup with ACTIONS_DEPLOY_KEY"
|
||||
|
||||
if [ -n "${SCRIPT_MODE}" ]; then
|
||||
print_info "run as SCRIPT_MODE"
|
||||
SSH_DIR="${HOME}/.ssh"
|
||||
else
|
||||
SSH_DIR="/root/.ssh"
|
||||
fi
|
||||
mkdir "${SSH_DIR}"
|
||||
ssh-keyscan -t rsa github.com > "${SSH_DIR}/known_hosts"
|
||||
echo "${ACTIONS_DEPLOY_KEY}" > "${SSH_DIR}/id_rsa"
|
||||
chmod 400 "${SSH_DIR}/id_rsa"
|
||||
|
||||
remote_repo="git@github.com:${PUBLISH_REPOSITORY}.git"
|
||||
|
||||
elif [ -n "${PERSONAL_TOKEN}" ]; then
|
||||
|
||||
print_info "setup with PERSONAL_TOKEN"
|
||||
|
||||
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@github.com/${PUBLISH_REPOSITORY}.git"
|
||||
|
||||
elif [ -n "${GITHUB_TOKEN}" ]; then
|
||||
|
||||
print_info "setup with GITHUB_TOKEN"
|
||||
print_error "GITHUB_TOKEN works only private repo, See #9"
|
||||
|
||||
if [ -n "${EXTERNAL_REPOSITORY}" ]; then
|
||||
print_error "can not use GITHUB_TOKEN to deploy to an external repository"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${PUBLISH_REPOSITORY}.git"
|
||||
|
||||
else
|
||||
print_error "not found ACTIONS_DEPLOY_KEY, PERSONAL_TOKEN, or GITHUB_TOKEN"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PUBLISH_BRANCH}" ]; then
|
||||
print_error "not found PUBLISH_BRANCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${PUBLISH_DIR}" ]; then
|
||||
print_error "not found PUBLISH_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
remote_branch="${PUBLISH_BRANCH}"
|
||||
|
||||
local_dir="${HOME}/ghpages_${RANDOM}"
|
||||
|
||||
if [[ "${INPUT_FORCEORPHAN}" == "true" ]]; then
|
||||
print_info "force ophan: ${INPUT_FORCEORPHAN}"
|
||||
cd "${PUBLISH_DIR}"
|
||||
git init
|
||||
git checkout --orphan "${remote_branch}"
|
||||
elif git clone --depth=1 --single-branch --branch "${remote_branch}" "${remote_repo}" "${local_dir}"; then
|
||||
cd "${local_dir}"
|
||||
|
||||
if [[ ${INPUT_KEEPFILES} == "true" ]]; then
|
||||
print_info "Keeping existing files: ${INPUT_KEEPFILES}"
|
||||
else
|
||||
git rm -r --ignore-unmatch '*'
|
||||
fi
|
||||
|
||||
find "${GITHUB_WORKSPACE}/${PUBLISH_DIR}" -maxdepth 1 -not -name ".git" -not -name ".github" | \
|
||||
tail -n +2 | \
|
||||
xargs -I % cp -rf % "${local_dir}/"
|
||||
else
|
||||
cd "${PUBLISH_DIR}"
|
||||
git init
|
||||
git checkout --orphan "${remote_branch}"
|
||||
fi
|
||||
|
||||
# push to publishing branch
|
||||
if [[ -n "${INPUT_USERNAME}" ]]; then
|
||||
git config user.name "${INPUT_USERNAME}"
|
||||
else
|
||||
git config user.name "${GITHUB_ACTOR}"
|
||||
fi
|
||||
if [[ -n "${INPUT_USEREMAIL}" ]]; then
|
||||
git config user.email "${INPUT_USEREMAIL}"
|
||||
else
|
||||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
fi
|
||||
git remote rm origin || true
|
||||
git remote add origin "${remote_repo}"
|
||||
git add --all
|
||||
|
||||
print_info "Allowing empty commits: ${INPUT_EMPTYCOMMITS}"
|
||||
|
||||
if [ -n "${INPUT_COMMITMESSAGE}" ]; then
|
||||
BASE_COMMIT_MESSAGE="${INPUT_COMMITMESSAGE}"
|
||||
else
|
||||
BASE_COMMIT_MESSAGE="Automated deployment: $(date -u)"
|
||||
fi
|
||||
|
||||
if [ -n "${EXTERNAL_REPOSITORY}" ]; then
|
||||
COMMIT_MESSAGE="${BASE_COMMIT_MESSAGE} ${GITHUB_REPOSITORY}@${GITHUB_SHA}"
|
||||
else
|
||||
COMMIT_MESSAGE="${BASE_COMMIT_MESSAGE} ${GITHUB_SHA}"
|
||||
fi
|
||||
|
||||
if [[ ${INPUT_EMPTYCOMMITS} == "false" ]]; then
|
||||
git commit -m "${COMMIT_MESSAGE}" || skip
|
||||
else
|
||||
git commit --allow-empty -m "${COMMIT_MESSAGE}"
|
||||
fi
|
||||
|
||||
if [[ ${INPUT_FORCEORPHAN} == "true" ]]; then
|
||||
git push origin --force "${remote_branch}"
|
||||
else
|
||||
git push origin "${remote_branch}"
|
||||
fi
|
||||
|
||||
if [[ -n "${INPUT_TAGNAME}" ]]; then
|
||||
print_info "Tag name: ${INPUT_TAGNAME}"
|
||||
print_info "Tag message: ${INPUT_TAGMESSAGE}"
|
||||
print_info "Tag overwrite: ${INPUT_TAGOVERWRITE}"
|
||||
if [[ -n "${INPUT_TAGMESSAGE}" ]]; then
|
||||
GIT_TAG_MESSAGE="${INPUT_TAGMESSAGE}"
|
||||
else
|
||||
GIT_TAG_MESSAGE="Deployment ${INPUT_TAGNAME}"
|
||||
fi
|
||||
if [[ "${INPUT_TAGOVERWRITE}" == "true" ]]; then
|
||||
GIT_TAG_OPTION="--force"
|
||||
else
|
||||
GIT_TAG_OPTION=""
|
||||
fi
|
||||
git tag "${GIT_TAG_OPTION}" -a "${INPUT_TAGNAME}" -m "${GIT_TAG_MESSAGE}"
|
||||
git push "${GIT_TAG_OPTION}" origin "${INPUT_TAGNAME}"
|
||||
fi
|
||||
|
||||
print_info "${GITHUB_SHA} was successfully deployed"
|
||||
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 |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 42 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 |
11
jest.config.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testRunner: 'jest-circus/runner',
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
verbose: true
|
||||
}
|
||||
26961
lib/index.js
Normal file
7916
package-lock.json
generated
Normal file
77
package.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"name": "actions-github-pages",
|
||||
"version": "3.5.4-6",
|
||||
"description": "GitHub Actions for GitHub Pages",
|
||||
"main": "lib/index.js",
|
||||
"engines": {
|
||||
"node": ">=12.16.1",
|
||||
"npm": ">=6.14.2"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint ./{src,__tests__}/**/*.ts",
|
||||
"lint:fix": "eslint --fix ./{src,__tests__}/**/*.ts",
|
||||
"test": "jest --coverage --verbose --detectOpenHandles",
|
||||
"build": "ncc build ./src/index.ts -o lib",
|
||||
"tsc": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format:check": "prettier --check **/*.ts",
|
||||
"release": "standard-version",
|
||||
"update-deps": "(git diff 'HEAD@{1}' --name-only | grep 'package-lock.json' > /dev/null) && npm ci || :"
|
||||
},
|
||||
"husky": {
|
||||
"skipCI": true,
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged",
|
||||
"post-merge": "npm run update-deps; git remote prune origin"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.ts": [
|
||||
"prettier --check",
|
||||
"eslint"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/peaceiris/actions-gh-pages.git"
|
||||
},
|
||||
"keywords": [
|
||||
"GitHub Actions",
|
||||
"Actions",
|
||||
"JavaScript Action",
|
||||
"TypeScript Action",
|
||||
"GitHub Pages",
|
||||
"gh-pages"
|
||||
],
|
||||
"author": "peaceiris",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/peaceiris/actions-gh-pages/issues"
|
||||
},
|
||||
"homepage": "https://github.com/peaceiris/actions-gh-pages#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.3",
|
||||
"@actions/exec": "^1.0.3",
|
||||
"@actions/github": "^2.1.1",
|
||||
"@actions/io": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^25.1.4",
|
||||
"@types/js-yaml": "^3.12.2",
|
||||
"@types/node": "~12",
|
||||
"@typescript-eslint/eslint-plugin": "^2.23.0",
|
||||
"@typescript-eslint/parser": "^2.23.0",
|
||||
"@zeit/ncc": "^0.21.1",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-jest": "^23.8.2",
|
||||
"husky": "^4.2.3",
|
||||
"jest": "^25.1.0",
|
||||
"jest-circus": "^25.1.0",
|
||||
"js-yaml": "^3.13.1",
|
||||
"lint-staged": "^10.0.8",
|
||||
"prettier": "1.19.1",
|
||||
"standard-version": "^7.1.0",
|
||||
"ts-jest": "^25.2.1",
|
||||
"typescript": "^3.8.3"
|
||||
}
|
||||
}
|
||||
68
release.sh
Executable file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# fail on unset variables and command errors
|
||||
set -eu -o pipefail # -x: is for debugging
|
||||
|
||||
CURRENT_BRANCH="$(git branch --show-current)"
|
||||
if [ "${CURRENT_BRANCH}" != "master" ]; then
|
||||
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
|
||||
|
||||
if command -v fzf; then
|
||||
RELEASE_TYPE=$(echo "${RELEASE_TYPE_LIST}" | tr ' ' '\n' | fzf --layout=reverse)
|
||||
else
|
||||
select sel in ${RELEASE_TYPE_LIST}; do
|
||||
RELEASE_TYPE="${sel}"
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
||||
echo "$0: Create ${RELEASE_TYPE} release, continue? (y/n)"
|
||||
read -r res
|
||||
if [ "${res}" = "n" ]; then
|
||||
echo "$0: Stop script"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git fetch origin
|
||||
if [ "${CURRENT_BRANCH}" != "master" ]; then
|
||||
git pull origin "${CURRENT_BRANCH}"
|
||||
else
|
||||
git pull origin master
|
||||
git tag -d v3 || true
|
||||
git pull origin --tags
|
||||
fi
|
||||
|
||||
npm ci
|
||||
|
||||
mkdir ./lib
|
||||
npm run build
|
||||
git add ./lib/index.js
|
||||
git commit -m "chore(release): Add build assets"
|
||||
|
||||
npm run release -- --release-as "${RELEASE_TYPE}" --preset eslint
|
||||
|
||||
git rm ./lib/index.js
|
||||
rm -rf ./lib
|
||||
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)"
|
||||
git push origin "${TAG_NAME}"
|
||||
71
src/get-inputs.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import * as core from '@actions/core';
|
||||
import {Inputs} from './interfaces';
|
||||
|
||||
export function showInputs(inps: Inputs): void {
|
||||
let authMethod = '';
|
||||
if (inps.DeployKey) {
|
||||
authMethod = 'DeployKey';
|
||||
} else if (inps.GithubToken) {
|
||||
authMethod = 'GithubToken';
|
||||
} else if (inps.PersonalToken) {
|
||||
authMethod = 'PersonalToken';
|
||||
}
|
||||
|
||||
core.info(`\
|
||||
[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}
|
||||
`);
|
||||
}
|
||||
|
||||
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 = {
|
||||
DeployKey: core.getInput('deploy_key'),
|
||||
GithubToken: core.getInput('github_token'),
|
||||
PersonalToken: core.getInput('personal_token'),
|
||||
PublishBranch: core.getInput('publish_branch'),
|
||||
PublishDir: core.getInput('publish_dir'),
|
||||
ExternalRepository: core.getInput('external_repository'),
|
||||
AllowEmptyCommit:
|
||||
(core.getInput('allow_empty_commit') || 'false').toUpperCase() === 'TRUE',
|
||||
KeepFiles:
|
||||
(core.getInput('keep_files') || 'false').toUpperCase() === 'TRUE',
|
||||
ForceOrphan:
|
||||
(core.getInput('force_orphan') || 'false').toUpperCase() === 'TRUE',
|
||||
UserName: core.getInput('user_name'),
|
||||
UserEmail: core.getInput('user_email'),
|
||||
CommitMessage: core.getInput('commit_message'),
|
||||
TagName: core.getInput('tag_name'),
|
||||
TagMessage: core.getInput('tag_message'),
|
||||
DisableNoJekyll: useBuiltinJekyll,
|
||||
CNAME: core.getInput('cname')
|
||||
};
|
||||
|
||||
return inps;
|
||||
}
|
||||
196
src/git-utils.ts
Normal file
@@ -0,0 +1,196 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as github from '@actions/github';
|
||||
import * as io from '@actions/io';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import {Inputs, CmdResult} from './interfaces';
|
||||
import {createWorkDir} from './utils';
|
||||
|
||||
export async function createBranchForce(branch: string): Promise<void> {
|
||||
await exec.exec('git', ['init']);
|
||||
await exec.exec('git', ['checkout', '--orphan', branch]);
|
||||
return;
|
||||
}
|
||||
|
||||
export async function copyAssets(
|
||||
publishDir: string,
|
||||
workDir: string
|
||||
): Promise<void> {
|
||||
const copyOpts = {recursive: true, force: true};
|
||||
const files = fs.readdirSync(publishDir);
|
||||
core.debug(`${files}`);
|
||||
for await (const file of files) {
|
||||
if (file.endsWith('.git') || file.endsWith('.github')) {
|
||||
continue;
|
||||
}
|
||||
const filePath = path.join(publishDir, file);
|
||||
await io.cp(filePath, `${workDir}/`, copyOpts);
|
||||
core.info(`[INFO] copy ${file}`);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
export async function setRepo(
|
||||
inps: Inputs,
|
||||
remoteURL: string,
|
||||
workDir: string
|
||||
): Promise<void> {
|
||||
const publishDir = path.join(
|
||||
`${process.env.GITHUB_WORKSPACE}`,
|
||||
inps.PublishDir
|
||||
);
|
||||
|
||||
core.info(`[INFO] ForceOrphan: ${inps.ForceOrphan}`);
|
||||
if (inps.ForceOrphan) {
|
||||
await createWorkDir(workDir);
|
||||
process.chdir(workDir);
|
||||
await createBranchForce(inps.PublishBranch);
|
||||
await copyAssets(publishDir, workDir);
|
||||
return;
|
||||
}
|
||||
|
||||
const result: CmdResult = {
|
||||
exitcode: 0,
|
||||
output: ''
|
||||
};
|
||||
const options = {
|
||||
listeners: {
|
||||
stdout: (data: Buffer): void => {
|
||||
result.output += data.toString();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
result.exitcode = await exec.exec(
|
||||
'git',
|
||||
[
|
||||
'clone',
|
||||
'--depth=1',
|
||||
'--single-branch',
|
||||
'--branch',
|
||||
inps.PublishBranch,
|
||||
remoteURL,
|
||||
workDir
|
||||
],
|
||||
options
|
||||
);
|
||||
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);
|
||||
process.chdir(workDir);
|
||||
await createBranchForce(inps.PublishBranch);
|
||||
await copyAssets(publishDir, workDir);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
userEmail: string
|
||||
): Promise<void> {
|
||||
if (userName && !userEmail) {
|
||||
throw new Error('user_email is undefined');
|
||||
}
|
||||
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 async function commit(
|
||||
allowEmptyCommit: boolean,
|
||||
externalRepository: string,
|
||||
message: string
|
||||
): Promise<void> {
|
||||
let msg = '';
|
||||
if (message) {
|
||||
msg = message;
|
||||
} else {
|
||||
msg = 'deploy:';
|
||||
}
|
||||
|
||||
const hash = `${process.env.GITHUB_SHA}`;
|
||||
const baseRepo = `${github.context.repo.owner}/${github.context.repo.repo}`;
|
||||
if (externalRepository) {
|
||||
msg = `${msg} ${baseRepo}@${hash}`;
|
||||
} else {
|
||||
msg = `${msg} ${hash}`;
|
||||
}
|
||||
|
||||
try {
|
||||
if (allowEmptyCommit) {
|
||||
await exec.exec('git', ['commit', '--allow-empty', '-m', `${msg}`]);
|
||||
} else {
|
||||
await exec.exec('git', ['commit', '-m', `${msg}`]);
|
||||
}
|
||||
} catch (e) {
|
||||
core.info('[INFO] skip commit');
|
||||
core.debug(`[INFO] skip commit ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function push(
|
||||
branch: string,
|
||||
forceOrphan: boolean
|
||||
): Promise<void> {
|
||||
if (forceOrphan) {
|
||||
await exec.exec('git', ['push', 'origin', '--force', branch]);
|
||||
} else {
|
||||
await exec.exec('git', ['push', 'origin', branch]);
|
||||
}
|
||||
}
|
||||
|
||||
export async function pushTag(
|
||||
tagName: string,
|
||||
tagMessage: string
|
||||
): Promise<void> {
|
||||
if (tagName === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
let msg = '';
|
||||
if (tagMessage) {
|
||||
msg = tagMessage;
|
||||
} else {
|
||||
msg = `Deployment ${tagName}`;
|
||||
}
|
||||
|
||||
await exec.exec('git', ['tag', '-a', `${tagName}`, '-m', `${msg}`]);
|
||||
await exec.exec('git', ['push', 'origin', `${tagName}`]);
|
||||
}
|
||||
10
src/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as main from './main';
|
||||
|
||||
(async (): Promise<void> => {
|
||||
try {
|
||||
await main.run();
|
||||
} catch (e) {
|
||||
core.setFailed(`Action failed with "${e.message}"`);
|
||||
}
|
||||
})();
|
||||
23
src/interfaces.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
export interface Inputs {
|
||||
readonly DeployKey: string;
|
||||
readonly GithubToken: string;
|
||||
readonly PersonalToken: string;
|
||||
readonly PublishBranch: string;
|
||||
readonly PublishDir: string;
|
||||
readonly ExternalRepository: string;
|
||||
readonly AllowEmptyCommit: boolean;
|
||||
readonly KeepFiles: boolean;
|
||||
readonly ForceOrphan: boolean;
|
||||
readonly UserName: string;
|
||||
readonly UserEmail: string;
|
||||
readonly CommitMessage: string;
|
||||
readonly TagName: string;
|
||||
readonly TagMessage: string;
|
||||
readonly DisableNoJekyll: boolean;
|
||||
readonly CNAME: string;
|
||||
}
|
||||
|
||||
export interface CmdResult {
|
||||
exitcode: number;
|
||||
output: string;
|
||||
}
|
||||
63
src/main.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import {context} from '@actions/github';
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import {Inputs} from './interfaces';
|
||||
import {showInputs, getInputs} from './get-inputs';
|
||||
import {setTokens} from './set-tokens';
|
||||
import {setRepo, setCommitAuthor, commit, push, pushTag} from './git-utils';
|
||||
import {getWorkDirName, addNoJekyll, addCNAME, skipOnFork} from './utils';
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
const inps: Inputs = getInputs();
|
||||
showInputs(inps);
|
||||
|
||||
// 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(
|
||||
'Action runs on fork and deploy_key or personal_token is empty, Skip deployment'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const remoteURL = await setTokens(inps);
|
||||
core.debug(`[INFO] remoteURL: ${remoteURL}`);
|
||||
|
||||
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);
|
||||
|
||||
try {
|
||||
await exec.exec('git', ['remote', 'rm', 'origin']);
|
||||
} catch (e) {
|
||||
core.info(`[INFO] ${e.message}`);
|
||||
}
|
||||
await exec.exec('git', ['remote', 'add', 'origin', remoteURL]);
|
||||
await exec.exec('git', ['add', '--all']);
|
||||
await setCommitAuthor(inps.UserName, inps.UserEmail);
|
||||
await commit(
|
||||
inps.AllowEmptyCommit,
|
||||
inps.ExternalRepository,
|
||||
inps.CommitMessage
|
||||
);
|
||||
await push(inps.PublishBranch, inps.ForceOrphan);
|
||||
await pushTag(inps.TagName, inps.TagMessage);
|
||||
|
||||
core.info('[INFO] Action successfully completed');
|
||||
|
||||
return;
|
||||
} catch (e) {
|
||||
throw new Error(e.message);
|
||||
}
|
||||
}
|
||||
140
src/set-tokens.ts
Normal file
@@ -0,0 +1,140 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as github from '@actions/github';
|
||||
import * as io from '@actions/io';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
const cpSpawnSync = require('child_process').spawnSync;
|
||||
const cpexec = require('child_process').execFileSync;
|
||||
import {Inputs} from './interfaces';
|
||||
import {getHomeDir} from './utils';
|
||||
|
||||
export async function setSSHKey(
|
||||
inps: Inputs,
|
||||
publishRepo: string
|
||||
): Promise<string> {
|
||||
core.info('[INFO] setup SSH deploy key');
|
||||
|
||||
const homeDir = await getHomeDir();
|
||||
const sshDir = path.join(homeDir, '.ssh');
|
||||
await io.mkdirP(sshDir);
|
||||
await exec.exec('chmod', ['700', sshDir]);
|
||||
|
||||
const knownHosts = path.join(sshDir, 'known_hosts');
|
||||
// ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts on Ubuntu
|
||||
const cmdSSHkeyscanOutput = `\
|
||||
# github.com:22 SSH-2.0-babeld-1f0633a6
|
||||
github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|
||||
`;
|
||||
fs.writeFileSync(knownHosts, cmdSSHkeyscanOutput + '\n');
|
||||
core.info(`[INFO] wrote ${knownHosts}`);
|
||||
await exec.exec('chmod', ['600', knownHosts]);
|
||||
|
||||
const idRSA = path.join(sshDir, 'github');
|
||||
fs.writeFileSync(idRSA, inps.DeployKey + '\n');
|
||||
core.info(`[INFO] wrote ${idRSA}`);
|
||||
await exec.exec('chmod', ['600', idRSA]);
|
||||
|
||||
const sshConfigPath = path.join(sshDir, 'config');
|
||||
const sshConfigContent = `\
|
||||
Host github
|
||||
HostName github.com
|
||||
IdentityFile ~/.ssh/github
|
||||
User git
|
||||
`;
|
||||
fs.writeFileSync(sshConfigPath, sshConfigContent + '\n');
|
||||
core.info(`[INFO] wrote ${sshConfigPath}`);
|
||||
await exec.exec('chmod', ['600', sshConfigPath]);
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
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']);
|
||||
core.exportVariable('SSH_AUTH_SOCK', '/tmp/ssh-auth.sock');
|
||||
await exec.exec('ssh-add', [idRSA]);
|
||||
|
||||
return `git@github.com:${publishRepo}.git`;
|
||||
}
|
||||
|
||||
export function setGithubToken(
|
||||
githubToken: string,
|
||||
publishRepo: string,
|
||||
publishBranch: string,
|
||||
externalRepository: string,
|
||||
ref: string,
|
||||
eventName: string
|
||||
): string {
|
||||
core.info('[INFO] setup GITHUB_TOKEN');
|
||||
|
||||
core.debug(`ref: ${ref}`);
|
||||
core.debug(`eventName: ${eventName}`);
|
||||
let isProhibitedBranch = false;
|
||||
|
||||
if (eventName === 'push') {
|
||||
isProhibitedBranch = ref.includes(`refs/heads/${publishBranch}`);
|
||||
if (isProhibitedBranch) {
|
||||
throw new Error(`You deploy from ${publishBranch} to ${publishBranch}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (externalRepository) {
|
||||
throw new Error(
|
||||
'GITHUB_TOKEN does not support to push to an external repository'
|
||||
);
|
||||
}
|
||||
|
||||
return `https://x-access-token:${githubToken}@github.com/${publishRepo}.git`;
|
||||
}
|
||||
|
||||
export function setPersonalToken(
|
||||
personalToken: string,
|
||||
publishRepo: string
|
||||
): string {
|
||||
core.info('[INFO] setup personal access token');
|
||||
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> {
|
||||
try {
|
||||
const publishRepo = getPublishRepo(
|
||||
inps.ExternalRepository,
|
||||
github.context.repo.owner,
|
||||
github.context.repo.repo
|
||||
);
|
||||
if (inps.DeployKey) {
|
||||
return setSSHKey(inps, publishRepo);
|
||||
} else if (inps.GithubToken) {
|
||||
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) {
|
||||
return setPersonalToken(inps.PersonalToken, publishRepo);
|
||||
} else {
|
||||
throw new Error('not found deploy key or tokens');
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(e.message);
|
||||
}
|
||||
}
|
||||
79
src/utils.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as io from '@actions/io';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
export async function getHomeDir(): Promise<string> {
|
||||
let homedir = '';
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
homedir = process.env['USERPROFILE'] || 'C:\\';
|
||||
} else {
|
||||
homedir = `${process.env.HOME}`;
|
||||
}
|
||||
|
||||
core.debug(`homeDir: ${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;
|
||||
}
|
||||
1
test_projects/mdbook/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
book
|
||||
6
test_projects/mdbook/book.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[book]
|
||||
authors = ["peaceiris"]
|
||||
language = "en"
|
||||
multilingual = false
|
||||
src = "src"
|
||||
title = "GitHub Actions for GitHub Pages"
|
||||
3
test_projects/mdbook/src/SUMMARY.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Summary
|
||||
|
||||
- [Chapter 1](./chapter_1.md)
|
||||
3
test_projects/mdbook/src/chapter_1.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# Chapter 1
|
||||
|
||||
test 7
|
||||
65
tsconfig.json
Normal file
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
"sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
"removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
||||