Compare commits

..

4 Commits

Author SHA1 Message Date
peaceiris
5393785496 refactor: enhance 2019-10-06 23:20:05 +09:00
peaceiris
61ffdece86 feat: Add SCRIPT_MODE 2019-10-06 23:11:39 +09:00
peaceiris
64e2296d31 Merge branch 'master' into release/v2.5.0 2019-10-06 21:10:14 +09:00
peaceiris
159b07d518 docs: update 2019-10-06 21:10:05 +09:00
2 changed files with 13 additions and 7 deletions

View File

@@ -254,10 +254,10 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0-rc0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
EXTERNAL_REPOSITORY: username/username.github.io
EXTERNAL_REPOSITORY: username/external-repository
PUBLISH_BRANCH: master
PUBLISH_DIR: ./public
```

View File

@@ -28,10 +28,16 @@ if [ -n "${ACTIONS_DEPLOY_KEY}" ]; then
print_info "setup with ACTIONS_DEPLOY_KEY"
mkdir "${HOME}/.ssh"
ssh-keyscan -t rsa github.com > "${HOME}/.ssh/known_hosts"
echo "${ACTIONS_DEPLOY_KEY}" > "${HOME}/.ssh/id_rsa"
chmod 400 "${HOME}/.ssh/id_rsa"
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"
@@ -70,7 +76,7 @@ fi
remote_branch="${PUBLISH_BRANCH}"
local_dir="${HOME}/$(tr -cd 'a-f0-9' < /dev/urandom | head -c 32)"
local_dir="${HOME}/ghpages_${RANDOM}"
if git clone --depth=1 --single-branch --branch "${remote_branch}" "${remote_repo}" "${local_dir}"; then
cd "${local_dir}"