Compare commits

..

3 Commits

Author SHA1 Message Date
peaceiris
51a5b047a7 docs: fix
Some checks failed
docker image ci / test (push) Has been cancelled
docker image ci / shellcheck (push) Has been cancelled
docker image ci / hadolint (push) Has been cancelled
2019-09-25 02:47:12 +09:00
peaceiris
649380ea44 docs: update TOC 2019-09-25 02:46:13 +09:00
peaceiris
493f73c406 fix: avoid #29 2019-09-25 02:43:21 +09:00
2 changed files with 14 additions and 47 deletions

View File

@@ -29,7 +29,6 @@ Table of Contents
- [⭐️ `GITHUB_TOKEN`](#%EF%B8%8F-github_token)
- [⭐️ Suppressing empty commits](#%EF%B8%8F-suppressing-empty-commits)
- [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files)
- [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository)
- [Tips and FAQ](#tips-and-faq)
- [How to add `CNAME`](#how-to-add-cname)
- [Deployment completed but you cannot read](#deployment-completed-but-you-cannot-read)
@@ -102,7 +101,7 @@ jobs:
# submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2.2.1
uses: peaceiris/actions-hugo@v2.2.0
with:
hugo-version: '0.58.3'
@@ -110,7 +109,7 @@ jobs:
run: hugo --gc --minify --cleanDestinationDir
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.3.2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -154,8 +153,8 @@ You can pull a public docker image from Docker Hub.
By pulling docker images, you can reduce the overall execution time of your workflow. In addition, `latest` tag is provided.
```diff
- uses: peaceiris/actions-gh-pages@v2.4.0
+ uses: docker://peaceiris/gh-pages:v2.4.0
- uses: peaceiris/actions-gh-pages@v2.3.2
+ uses: docker://peaceiris/gh-pages:v2.3.2
```
- [peaceiris/gh-pages - Docker Hub](https://hub.docker.com/r/peaceiris/gh-pages)
@@ -192,7 +191,7 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.3.2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -209,7 +208,7 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.3.2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -218,26 +217,6 @@ For example:
keepFiles: true
```
#### ⭐️ Deploy to external repository
By default, your files are published to the repository which is running this action. If you want to publish to another repository on GitHub, set the environment variable `EXTERNAL_REPOSITORY` to `<username>/<external-repository>`.
For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
EXTERNAL_REPOSITORY: username/username.github.io
PUBLISH_BRANCH: master
PUBLISH_DIR: ./public
```
You can use `ACTIONS_DEPLOY_KEY` or `PERSONAL_TOKEN`. When you use `ACTIONS_DEPLOY_KEY`, set your private key to the repository which includes this action and set your public key to your external repository.
Be careful, `GITHUB_TOKEN` has no permission to access to external repositories.
## Tips and FAQ
@@ -302,7 +281,7 @@ jobs:
npm run build
- name: deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.3.2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -350,7 +329,7 @@ jobs:
run: npm run build
- name: deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.3.2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -400,7 +379,7 @@ jobs:
run: touch ./out/.nojekyll
- name: deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.3.2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -447,7 +426,7 @@ jobs:
run: npm run generate
- name: deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.3.2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -495,7 +474,7 @@ jobs:
run: mkdocs build
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.3.2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages

View File

@@ -17,13 +17,6 @@ function skip() {
}
# 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"
@@ -33,25 +26,20 @@ if [ -n "${ACTIONS_DEPLOY_KEY}" ]; then
echo "${ACTIONS_DEPLOY_KEY}" > /root/.ssh/id_rsa
chmod 400 /root/.ssh/id_rsa
remote_repo="git@github.com:${PUBLISH_REPOSITORY}.git"
remote_repo="git@github.com:${GITHUB_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"
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
elif [ -n "${GITHUB_TOKEN}" ]; then
print_info "setup with GITHUB_TOKEN"
print_error "Do not use GITHUB_TOKEN, See #9"
if [ -n "${EXTERNAL_REPOSITORY}" ]; then
print_error "can not use GITHUB_TOKEN to deploy to a external repository"
exit 1
fi
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${PUBLISH_REPOSITORY}.git"
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
else
print_error "not found ACTIONS_DEPLOY_KEY, PERSONAL_TOKEN, or GITHUB_TOKEN"