From 036c4a14e0fee05370e4bd3b55cce6749e607935 Mon Sep 17 00:00:00 2001
From: peaceiris <30958501+peaceiris@users.noreply.github.com>
Date: Wed, 22 May 2019 06:53:54 +0900
Subject: [PATCH] add: action
---
.dockerignore | 5 +++
.github/main.workflow | 9 +++++
Dockerfile | 17 ++++++++++
LICENSE | 2 +-
README.md | 75 ++++++++++++++++++++++++++++++++++++++++--
entrypoint.sh | 33 +++++++++++++++++++
images/ogp.svg | 20 +++++++++++
images/patreon.jpg | Bin 0 -> 3531 bytes
8 files changed, 158 insertions(+), 3 deletions(-)
create mode 100644 .dockerignore
create mode 100644 .github/main.workflow
create mode 100644 Dockerfile
create mode 100755 entrypoint.sh
create mode 100644 images/ogp.svg
create mode 100644 images/patreon.jpg
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000..e64b7f85a
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,5 @@
+.git
+.github
+LICENSE
+README.md
+images
diff --git a/.github/main.workflow b/.github/main.workflow
new file mode 100644
index 000000000..032cfda2e
--- /dev/null
+++ b/.github/main.workflow
@@ -0,0 +1,9 @@
+workflow "Main workflow" {
+ on = "push"
+ resolves = ["docker-build"]
+}
+
+action "docker-build" {
+ uses = "actions/docker/cli@master"
+ args = "build -t peaceiris/actions-gh-deploy ."
+}
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..6f8b6bb7c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,17 @@
+FROM alpine:3.9
+
+LABEL "com.github.actions.name"="Deploy to GitHub Pages for Static Site Generator"
+LABEL "com.github.actions.description"="A GitHub Action to deploy your static site to GitHub Pages with Static Site Generator"
+LABEL "com.github.actions.icon"="upload-cloud"
+LABEL "com.github.actions.color"="blue"
+
+LABEL "repository"="https://github.com/peaceiris/actions-gh-pages"
+LABEL "homepage"="https://github.com/peaceiris/actions-gh-pages"
+LABEL "maintainer"="peaceiris"
+
+RUN apk add --no-cache \
+ git \
+ openssh-client
+
+ADD entrypoint.sh /entrypoint.sh
+ENTRYPOINT [ "/entrypoint.sh" ]
diff --git a/LICENSE b/LICENSE
index 82bff4341..11c076936 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2019 Shohei Ueda
+Copyright (c) 2019 Shohei Ueda (peaceiris)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/README.md b/README.md
index ae983c254..fd1b9030f 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,73 @@
-# actions-gh-deploy
-GitHub Actions for deploying to GitHub Pages with Static Site Generators
+[![license](https://img.shields.io/github/license/peaceiris/actions-gh-pages.svg)](https://github.com/peaceiris/actions-gh-pages/blob/master/LICENSE)
+[![release](https://img.shields.io/github/release/peaceiris/actions-gh-pages.svg)](https://github.com/peaceiris/actions-gh-pages/releases/latest)
+[![GitHub release date](https://img.shields.io/github/release-date/peaceiris/actions-gh-pages.svg)](https://github.com/peaceiris/actions-gh-pages/releases)
+
+
+
+
+
+## GitHub Actions for deploying to GitHub Pages
+
+A GitHub Action to deploy your static site to GitHub Pages with [Static Site Generators] (Hugo, MkDocs, Gatsby, GitBook, etc.)
+
+[Static Site Generators]: https://www.staticgen.com/
+
+
+
+## Getting started
+
+### (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`
+
+### (2) Create `main.workflow`
+
+An example with Hugo action.
+
+- [peaceiris/actions-hugo: GitHub Actions for Hugo extended](https://github.com/peaceiris/actions-hugo)
+
+```hcl
+workflow "GitHub Pages" {
+ on = "push"
+ resolves = ["deploy"]
+}
+
+action "is-branch-master" {
+ uses = "actions/bin/filter@master"
+ args = "branch master"
+}
+
+action "build" {
+ needs = "is-branch-master"
+ uses = "peaceiris/actions-hugo@v0.55.6"
+ args = ["--gc", "--minify", "--cleanDestinationDir"]
+}
+
+action "deploy" {
+ needs = "build"
+ uses = "peaceiris/actions-gh-pages@v1.0.0"
+ env = {
+ PUBLISH_DIR = "./public"
+ PUBLISH_BRANCH = "gh-pages"
+ }
+ secrets = ["ACTIONS_DEPLOY_KEY"]
+}
+```
+
+
+
+## License
+
+[MIT License - peaceiris/actions-gh-pages]
+
+[MIT License - peaceiris/actions-gh-pages]: https://github.com/peaceiris/actions-gh-pages/blob/master/LICENSE
+
+
+
+## Supprt author
+
+
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755
index 000000000..c2cfe807f
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# setup ssh
+if [[ -z "${ACTIONS_DEPLOY_KEY}" ]]; then
+ echo "error: not found ACTIONS_DEPLOY_KEY"
+ exit 1
+fi
+mkdir /root/.ssh
+ssh-keyscan -t rsa github.com > /root/.ssh/known_hosts
+echo "${ACTIONS_DEPLOY_KEY}" > /root/.ssh/id_rsa
+chmod 400 /root/.ssh/id_rsa
+
+# push to gh-pages branch
+if [[ -z "${PUBLISH_DIR}" ]]; then
+ echo "error: not found PUBLISH_DIR"
+ exit 1
+fi
+cd ${PUBLISH_DIR}
+if [[ -z "${PUBLISH_BRANCH}" ]]; then
+ echo "error: not found PUBLISH_BRANCH"
+ exit 1
+fi
+remote_repo="git@github.com:${GITHUB_REPOSITORY}.git"
+remote_branch="${PUBLISH_BRANCH}"
+git init
+git config user.name "${GITHUB_ACTOR}"
+git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
+git remote add origin "${remote_repo}"
+git checkout "${remote_branch}" || git checkout --orphan "${remote_branch}"
+git add --all
+timestamp=$(date -u)
+git commit -m "Automated deployment: ${timestamp} ${GITHUB_SHA}"
+git push origin "${remote_branch}" --force
diff --git a/images/ogp.svg b/images/ogp.svg
new file mode 100644
index 000000000..c8476c092
--- /dev/null
+++ b/images/ogp.svg
@@ -0,0 +1,20 @@
+
diff --git a/images/patreon.jpg b/images/patreon.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..1c680522a8e28054c4ae47c1a6c84862bd90a3ff
GIT binary patch
literal 3531
zcmbtWcT|&E(|?lCrG+9L>7W!z=uH&qN~DG&N-s+9Or(bM8IQ+%vzKJHI(|=X~P)GeEDasiO&iKmY(DPT+hR
zhy*BzgOY-hii(nkmYSA^5lT-FW#nYKOq`se99KAqpQw<8Aito5kh;wE>oV#HwHs;(
zD-#o|0IvWHW*GGU1vqa7pcH^3s0sq&1He!a1PVHD2RMlif+3&_U;h~-WDrtvFo@!O
z3ZVEUp9uTs?0@WwToteTUm>Y~=LdR=rt|^%b6_PQ
zc2BRDHj#{`ys&v$iK9?qm0soUu*F)<9f=>}EV=E^91H`@5VjpmLl=QSc@5UD0Uzg2rYbkyw#*tUC}51*SueFL^^OgJF8iF6*o6vq
zw{WE5(-Nf>gTnqbp-M#OAfjI|@UIX6z$73DDH-`sc*q6(i9T_Gp@_@v&OH@VpNOoJ
z^gczIt(|3YorTaOIzg*Xe#*Xe(<2tNW0z9US$YQrYaJqU{|8C5BS8;`U>&7>%zO?M;+b8mlwU;a!VBH`OR>^4fu^c#Q__Smozl-T>?{S`
z2Bizal&zXlsJJkJFmj{q)0v>a#Fbkpo^Y!53D+QT>U7(Q1}}R-HgP&u*aC`V#CZ<5$
z50>>fx$sUdxs*|RR}0`9U0YEnz1FhyWb>9-c?-uIG%u-nvrryI}&O?t_Zb>Ry`np^LYQN
zq3ip(aknmNdBwc?M+2iwS4p`#)eF{evzRZ*O^wD8j`=VTPm@q&iF6zSvSy=hw+oNU
z=VzmhT&SQLu9;lRy>vLIkx-~Zs^qig;(jXAOu<<`Yx#8J?NH{#^E+3>M>a+9h}~6V
zYTJg`knsGq8iO~sezn&EDs;|)z}b(p{^qi|V-)U^jqr)YPh%6*io_iU)WT1g5Y
z(Vx$kxDaS6|K(Bq_+i~Txs5qHP3OdM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