Compare commits

..

7 Commits

Author SHA1 Message Date
peaceiris
95773e0623 fix: shellcheck errors 2019-05-26 22:37:08 +09:00
peaceiris
f2d1faaacf add: mkdocs example 2019-05-26 06:32:29 +09:00
peaceiris
9bfcfe68ee enhance: description for (1) Add deploy Key 2019-05-26 00:56:03 +09:00
Shohei Ueda
6009c110fc Create FUNDING.yml (#2) 2019-05-24 21:40:48 +09:00
peaceiris
87dceaf2d6 add: link to peaceiris's homepage 2019-05-22 21:11:01 +09:00
Zero
3400745573 Update README.md (#1)
"Supprt" > "Support" on the penultimate line.
2019-05-22 15:15:31 +09:00
peaceiris
7c2aa28333 enhance: explanation for (1) Add deploy Key 2019-05-22 07:25:01 +09:00
3 changed files with 72 additions and 10 deletions

8
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
# These are supported funding model platforms
github: peaceiris
patreon: peaceiris
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: # Replace with a single custom sponsorship URL

View File

@@ -18,11 +18,20 @@ A GitHub Action to deploy your static site to GitHub Pages with [Static Site Gen
### (1) Add deploy Key
1. Generate deploy key `ssh-keygen -t rsa -b 4096 -C "your@email.com" -f gh-pages -N ""`
2. Go to "Settings > Deploy Keys" of repository.
3. Add your public key within "Allow write access" option.
4. Go to "Settings > Secrets" of repository.
5. Add your private deploy key as `ACTIONS_DEPLOY_KEY`
Generate deploy key with the following command.
```sh
ssh-keygen -t rsa -b 4096 -C "your@email.com" -f gh-pages -N ""
# You will get 2 files:
# gh-pages.pub (public key)
# gh-pages (private key)
```
Next, Go to **Repository Settings**
- Go to **Deploy Keys** and add your public key with the "Allow write access"
- Go to **Secrets** and add your private key as `ACTIONS_DEPLOY_KEY`
### (2) Create `main.workflow`
@@ -60,6 +69,49 @@ action "deploy" {
## Examples
### MkDocs
- [peaceiris/actions-pipenv: GitHub Actions for pipenv](https://github.com/peaceiris/actions-pipenv)
- [main.workflow - peaceiris/mkdocs-material-boilerplate](https://github.com/peaceiris/mkdocs-material-boilerplate/blob/master/.github/main.workflow)
```hcl
workflow "MkDocs workflow" {
on = "push"
resolves = ["deploy"]
}
action "branch-filter" {
uses = "actions/bin/filter@master"
args = "branch master"
}
action "pipenv-sync" {
needs = ["branch-filter"]
uses = "peaceiris/actions-pipenv@3.6"
args = "sync"
}
action "mkdocs-build" {
needs = ["pipenv-sync"]
uses = "peaceiris/actions-pipenv@3.6"
args = ["run", "mkdocs", "build", "--config-file", "./mkdocs-sample.yml"]
}
action "deploy" {
needs = ["mkdocs-build"]
uses = "peaceiris/actions-gh-pages@v1.0.0"
env = {
PUBLISH_DIR = "./site"
PUBLISH_BRANCH = "gh-pages"
}
secrets = ["ACTIONS_DEPLOY_KEY"]
}
```
## License
[MIT License - peaceiris/actions-gh-pages]
@@ -68,6 +120,8 @@ action "deploy" {
## Supprt author
## About the author
- [peaceiris's homepage](https://peaceiris.com/)
<a href="https://www.patreon.com/peaceiris"><img src="./images/patreon.jpg" alt="peaceiris - Patreon" width="150px"></a>

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# setup ssh
if [[ -z "${ACTIONS_DEPLOY_KEY}" ]]; then
if [ -z "${ACTIONS_DEPLOY_KEY}" ]; then
echo "error: not found ACTIONS_DEPLOY_KEY"
exit 1
fi
@@ -11,12 +11,12 @@ echo "${ACTIONS_DEPLOY_KEY}" > /root/.ssh/id_rsa
chmod 400 /root/.ssh/id_rsa
# push to gh-pages branch
if [[ -z "${PUBLISH_DIR}" ]]; then
if [ -z "${PUBLISH_DIR}" ]; then
echo "error: not found PUBLISH_DIR"
exit 1
fi
cd ${PUBLISH_DIR}
if [[ -z "${PUBLISH_BRANCH}" ]]; then
cd "${PUBLISH_DIR}" || exit 1
if [ -z "${PUBLISH_BRANCH}" ]; then
echo "error: not found PUBLISH_BRANCH"
exit 1
fi