Skip to content

Commit 5af287f

Browse files
authored
release v1.1.0 (#4)
* change: use GITHUB_TOKEN instead of ACTIONS_DEPLOY_KEY * enhance: entrypoint.sh * update: readme for v1.1.0 (Fixes #3) * remove: images/patreon.jpg
1 parent 1f78e2b commit 5af287f

File tree

3 files changed

+19
-38
lines changed

3 files changed

+19
-38
lines changed

README.md

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,7 @@ A GitHub Action to deploy your static site to GitHub Pages with [Static Site Gen
1616

1717
## Getting started
1818

19-
### (1) Add deploy Key
20-
21-
Generate deploy key with the following command.
22-
23-
```sh
24-
ssh-keygen -t rsa -b 4096 -C "your@email.com" -f gh-pages -N ""
25-
26-
# You will get 2 files:
27-
# gh-pages.pub (public key)
28-
# gh-pages (private key)
29-
```
30-
31-
Next, Go to **Repository Settings**
32-
33-
- Go to **Deploy Keys** and add your public key with the "Allow write access"
34-
- Go to **Secrets** and add your private key as `ACTIONS_DEPLOY_KEY`
35-
36-
### (2) Create `main.workflow`
19+
### Create `.github/main.workflow`
3720

3821
An example with Hugo action.
3922

@@ -60,18 +43,18 @@ action "is-not-branch-deleted" {
6043
6144
action "build" {
6245
needs = ["is-branch-master", "is-not-branch-deleted"]
63-
uses = "peaceiris/actions-hugo@v0.55.6"
46+
uses = "peaceiris/actions-hugo@v0.56.3"
6447
args = ["--gc", "--minify", "--cleanDestinationDir"]
6548
}
6649
6750
action "deploy" {
6851
needs = "build"
69-
uses = "peaceiris/actions-gh-pages@v1.0.1"
52+
uses = "peaceiris/actions-gh-pages@v1.1.0"
7053
env = {
7154
PUBLISH_DIR = "./public"
7255
PUBLISH_BRANCH = "gh-pages"
7356
}
74-
secrets = ["ACTIONS_DEPLOY_KEY"]
57+
secrets = ["GITHUB_TOKEN"]
7558
}
7659
```
7760

@@ -115,12 +98,12 @@ action "mkdocs-build" {
11598
11699
action "deploy" {
117100
needs = ["mkdocs-build"]
118-
uses = "peaceiris/actions-gh-pages@v1.0.1"
101+
uses = "peaceiris/actions-gh-pages@v1.1.0"
119102
env = {
120103
PUBLISH_DIR = "./site"
121104
PUBLISH_BRANCH = "gh-pages"
122105
}
123-
secrets = ["ACTIONS_DEPLOY_KEY"]
106+
secrets = ["GITHUB_TOKEN"]
124107
}
125108
```
126109

@@ -137,5 +120,3 @@ action "deploy" {
137120
## About the author
138121

139122
- [peaceiris's homepage](https://peaceiris.com/)
140-
141-
<a href="https://www.patreon.com/peaceiris"><img src="./images/patreon.jpg" alt="peaceiris - Patreon" width="150px"></a>

entrypoint.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
#!/bin/sh
22

3-
# setup ssh
4-
if [ -z "${ACTIONS_DEPLOY_KEY}" ]; then
5-
echo "error: not found ACTIONS_DEPLOY_KEY"
3+
# check values
4+
if [ -z "${GITHUB_TOKEN}" ]; then
5+
echo "error: not found GITHUB_TOKEN"
6+
exit 1
7+
fi
8+
9+
if [ -z "${PUBLISH_BRANCH}" ]; then
10+
echo "error: not found PUBLISH_BRANCH"
611
exit 1
712
fi
8-
mkdir /root/.ssh
9-
ssh-keyscan -t rsa github.com > /root/.ssh/known_hosts
10-
echo "${ACTIONS_DEPLOY_KEY}" > /root/.ssh/id_rsa
11-
chmod 400 /root/.ssh/id_rsa
1213

13-
# push to gh-pages branch
1414
if [ -z "${PUBLISH_DIR}" ]; then
1515
echo "error: not found PUBLISH_DIR"
1616
exit 1
1717
fi
1818
cd "${PUBLISH_DIR}" || exit 1
19-
if [ -z "${PUBLISH_BRANCH}" ]; then
20-
echo "error: not found PUBLISH_BRANCH"
21-
exit 1
22-
fi
23-
remote_repo="git@github.com:${GITHUB_REPOSITORY}.git"
19+
20+
# initialize git
21+
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
2422
remote_branch="${PUBLISH_BRANCH}"
2523
git init
2624
git config user.name "${GITHUB_ACTOR}"
2725
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
2826
git remote add origin "${remote_repo}"
27+
28+
# push to publishing branch
2929
git checkout "${remote_branch}" || git checkout --orphan "${remote_branch}"
3030
git add --all
3131
timestamp=$(date -u)

images/patreon.jpg

-3.45 KB
Binary file not shown.

0 commit comments

Comments
 (0)