From 7546e3a187cf92f32751c30a7814d74585a08e7f Mon Sep 17 00:00:00 2001 From: James Ives Date: Sun, 17 Mar 2019 23:50:57 -0400 Subject: [PATCH 1/2] CNAME --- README.md | 1 + entrypoint.sh | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 646205a6..e73f5a2c 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ The `secrets` and `env` portion of the workflow **must** be configured before th | `BUILD_SCRIPT` | If you require a build script to compile your code prior to pushing it you can add the script here. The Docker container which powers the action runs Node which means `npm` commands are valid. If you're using a static site generator such as Jekyll I'd suggest compiling the code prior to pushing it to your base branch. | `env` | **No** | | `COMMIT_NAME` | Used to sign the commit, this should be your name. If not provided it will default to `username@users.noreply.github.com` | `env` | **No** | | `COMMIT_EMAIL` | Used to sign the commit, this should be your email. If not provided it will default to your username. | `env` | **No** | +| `CNAME` | If you're using a custom domain, you will need to add the domain name to the `CNAME` environment variable. If you don't do this GitHub will wipe out your domain configuration after each deploy. This value will look something like this: `jamesives.dev`. | `env` | **No** | With the action correctly configured you should see something similar to this in your GitHub actions workflow editor. diff --git a/entrypoint.sh b/entrypoint.sh index c28953ae..5f5aa259 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -64,9 +64,15 @@ git checkout "${BASE_BRANCH:-master}" && \ echo "Running build scripts... $BUILD_SCRIPT" && \ eval "$BUILD_SCRIPT" && \ +if [ "$CNAME" ]; then + echo "Generating a CNAME file in in the $FOLDER directory." + echo $CNAME > $FOLDER/CNAME +fi + # Commits the data to Github. echo "Deploying to GitHub..." && \ git add -f $FOLDER && \ + git commit -m "Deploying to ${BRANCH} - $(date +"%T")" && \ git push $REPOSITORY_PATH `git subtree split --prefix $FOLDER master`:$BRANCH --force && \ echo "Deployment succesful!" \ No newline at end of file From 431283742db072c3b69985d1af0f406b4cd936f6 Mon Sep 17 00:00:00 2001 From: James Ives Date: Sun, 17 Mar 2019 23:56:01 -0400 Subject: [PATCH 2/2] Editing comment --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 5f5aa259..a5c3704f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -65,7 +65,7 @@ echo "Running build scripts... $BUILD_SCRIPT" && \ eval "$BUILD_SCRIPT" && \ if [ "$CNAME" ]; then - echo "Generating a CNAME file in in the $FOLDER directory." + echo "Generating a CNAME file in in the $FOLDER directory..." echo $CNAME > $FOLDER/CNAME fi