Compare commits

...

7 Commits

Author SHA1 Message Date
peaceiris
7a3cc6d532 docs: update 2019-10-06 20:23:00 +09:00
peaceiris
727fb697cd docs: Add new section about Script mode, close #37 2019-10-06 20:19:04 +09:00
peaceiris
5897005fde docs: Update about GITHUB_TOKEN 2019-10-06 20:10:53 +09:00
peaceiris
77afd3c2c9 Merge branch 'master' into release/v2.5.0 2019-10-06 19:43:11 +09:00
peaceiris
039d96984d Merge branch 'master' into release/v2.5.0 2019-10-03 11:32:55 +09:00
peaceiris
896aa8fc53 gha: enhance trigger 2019-10-01 20:09:26 +09:00
peaceiris
aa82ef0992 refactor: Use HOME instead of /root 2019-10-01 20:06:09 +09:00
3 changed files with 26 additions and 6 deletions

View File

@ -4,6 +4,8 @@ on:
pull_request: pull_request:
types: [opened, synchronize] types: [opened, synchronize]
push: push:
branches:
- master
jobs: jobs:
test: test:

View File

@ -46,6 +46,7 @@ The above example step will deploy `./public` directory to `gh-pages` branch.
- [⭐️ Suppressing empty commits](#%EF%B8%8F-suppressing-empty-commits) - [⭐️ Suppressing empty commits](#%EF%B8%8F-suppressing-empty-commits)
- [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files) - [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files)
- [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository) - [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository)
- [⭐️ Script mode](#%EF%B8%8F-script-mode)
- [Tips and FAQ](#tips-and-faq) - [Tips and FAQ](#tips-and-faq)
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release) - [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
- [⭐️ How to add `CNAME`](#%EF%B8%8F-how-to-add-cname) - [⭐️ How to add `CNAME`](#%EF%B8%8F-how-to-add-cname)
@ -196,7 +197,7 @@ By pulling docker images, you can reduce the overall execution time of your work
### ⭐️ `GITHUB_TOKEN` ### ⭐️ `GITHUB_TOKEN`
> **NOTES**: Do not use `GITHUB_TOKEN`. > ⚠️ **NOTES**: `GITHUB_TOKEN` works only on a **private** repository.
> >
> This action supports `GITHUB_TOKEN` but it has some problems to deploy to GitHub Pages. GitHub team is investigating that. See [Issue #9] > This action supports `GITHUB_TOKEN` but it has some problems to deploy to GitHub Pages. GitHub team is investigating that. See [Issue #9]
@ -247,6 +248,7 @@ For example:
By default, your files are published to the repository which is running this action. 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>`. If you want to publish to another repository on GitHub, set the environment variable `EXTERNAL_REPOSITORY` to `<username>/<external-repository>`.
This option is available from `v2.5.0`.
For example: For example:
@ -265,6 +267,22 @@ When you use `ACTIONS_DEPLOY_KEY`, set your private key to the repository which
Be careful, `GITHUB_TOKEN` has no permission to access to external repositories. Be careful, `GITHUB_TOKEN` has no permission to access to external repositories.
### ⭐️ Script mode
From `v2.5.0`, we can run this action as a shell script.
There is no Docker build or pull step, so it will start immediately.
```yaml
- name: Deploy
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
run: |
wget https://raw.githubusercontent.com/peaceiris/actions-gh-pages/v2.5.0/entrypoint.sh
bash ./entrypoint.sh
```
<div align="right"> <div align="right">
<a href="#table-of-contents">Back to TOC ☝️</a> <a href="#table-of-contents">Back to TOC ☝️</a>
</div> </div>

View File

@ -28,10 +28,10 @@ if [ -n "${ACTIONS_DEPLOY_KEY}" ]; then
print_info "setup with ACTIONS_DEPLOY_KEY" print_info "setup with ACTIONS_DEPLOY_KEY"
mkdir /root/.ssh mkdir "${HOME}/.ssh"
ssh-keyscan -t rsa github.com > /root/.ssh/known_hosts ssh-keyscan -t rsa github.com > "${HOME}/.ssh/known_hosts"
echo "${ACTIONS_DEPLOY_KEY}" > /root/.ssh/id_rsa echo "${ACTIONS_DEPLOY_KEY}" > "${HOME}/.ssh/id_rsa"
chmod 400 /root/.ssh/id_rsa chmod 400 "${HOME}/.ssh/id_rsa"
remote_repo="git@github.com:${PUBLISH_REPOSITORY}.git" remote_repo="git@github.com:${PUBLISH_REPOSITORY}.git"
@ -44,7 +44,7 @@ elif [ -n "${PERSONAL_TOKEN}" ]; then
elif [ -n "${GITHUB_TOKEN}" ]; then elif [ -n "${GITHUB_TOKEN}" ]; then
print_info "setup with GITHUB_TOKEN" print_info "setup with GITHUB_TOKEN"
print_error "Do not use GITHUB_TOKEN, See #9" print_error "GITHUB_TOKEN works only private repo, See #9"
if [ -n "${EXTERNAL_REPOSITORY}" ]; then if [ -n "${EXTERNAL_REPOSITORY}" ]; then
print_error "can not use GITHUB_TOKEN to deploy to a external repository" print_error "can not use GITHUB_TOKEN to deploy to a external repository"