From 00666ba118225e782c3201b563dc189c55954dc0 Mon Sep 17 00:00:00 2001 From: Benny Powers Date: Thu, 14 Mar 2019 14:46:28 +0200 Subject: [PATCH] write $GH_CNAME to CNAME before commiting closes #12 --- README.md | 9 +++++---- entrypoint.sh | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f238582..3d2afa9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Remember that you may also have to adjust your [repository settings](https://hel Because this action deploys to separate, "deploy-only" branches, you can not use it if you want to deploy from a repo subdirectory such as `docs/`. In those cases you really don't need a GitHub Action, because you would be committing the build artifacts yourself. -For details see the [GitHub Pages Documentation](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/). +For details see the [GitHub Pages Documentation](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/). There are already great GitHub actions to use static site generators *and* then deploy to GitHub Pages (for [jekyll](https://github.com/helaili/jekyll-action), [jekyll](https://github.com/BryanSchuetz/jekyll-deploy-gh-pages), [zola](https://github.com/shalzz/zola-deploy-action) and surely many more to come). This action isn't that, though I've borrowed much of the git action from these works. @@ -40,9 +40,10 @@ The discussion is documented [here](https://github.com/maxheld83/ghaction-ghpage ## Environment Variables -Just `BUILD_DIR`, the build directory relative to your repository root. -You can also pass `.` if you want to push your repository root. - +|Variable|Meaning| +|-----|-----| +|`BUILD_DIR`|The build directory relative to your repository root. You can also pass `.` if you want to push your repository root.| +|`GH_CNAME`|Your custom domain name. Will be written to the `CNAME` file in your `BUILD_DIR`.| ## Arguments diff --git a/entrypoint.sh b/entrypoint.sh index a055643..50b30e4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,6 +17,12 @@ if [[ "$REPONAME" == "$GHIO" ]]; then else REMOTE_BRANCH="gh-pages" fi && \ +if [[ -z "$GH_CNAME" ]]; then + echo "No CNAME is set" +else + echo "Setting CNAME" + echo $GH_CNAME > CNAME +fi && \ git init && \ git config user.name "${GITHUB_ACTOR}" && \ git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" && \