From 989f94fd42f4f115676f9f7d0aeb61fe18e3b8e4 Mon Sep 17 00:00:00 2001 From: Artem Sidorenko Date: Fri, 7 Dec 2018 05:52:14 +0100 Subject: [PATCH 1/4] Removing the submodules we are going to have it without submodules with git clone/push approach Signed-off-by: Artem Sidorenko --- .gitmodules | 4 ---- public | 1 - 2 files changed, 5 deletions(-) delete mode 100644 .gitmodules delete mode 160000 public diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index a152e9c..0000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "public"] - path = public - url = git@github.com:dev-sec/dev-sec.github.io.git - branch = master diff --git a/public b/public deleted file mode 160000 index ee9a7c4..0000000 --- a/public +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ee9a7c4371b3ca13d59927cd5229b6d4733ce1b2 From 851e5ee5cf1e829297087e6bfa3ff3375773d203 Mon Sep 17 00:00:00 2001 From: Artem Sidorenko Date: Fri, 7 Dec 2018 05:54:51 +0100 Subject: [PATCH 2/4] Lets have CNAME in within static files otherwise it gets removed from the web page repository Signed-off-by: Artem Sidorenko --- static/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 static/CNAME diff --git a/static/CNAME b/static/CNAME new file mode 100644 index 0000000..fd68c22 --- /dev/null +++ b/static/CNAME @@ -0,0 +1 @@ +dev-sec.io From 42bf8d1b16878166981b16ca861761b98587f5a2 Mon Sep 17 00:00:00 2001 From: Artem Sidorenko Date: Fri, 7 Dec 2018 07:03:23 +0100 Subject: [PATCH 3/4] Use Travis for autodeployment of web page Signed-off-by: Artem Sidorenko --- .gitignore | 2 ++ .travis.yml | 14 ++++++++++++++ deploy.sh | 35 +++++++++++++++-------------------- 3 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index 18f2c0c..fc587c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ tools/contributors/node_modules tools/contributors/contributors.json +/public +/deployment diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8a4e2ae --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +--- +install: + - wget -O /tmp/hugo.deb https://github.com/gohugoio/hugo/releases/download/v0.52/hugo_0.52_Linux-64bit.deb + - sudo dpkg -i /tmp/hugo.deb + +script: + - hugo -t devsec + +deploy: + - provider: script + script: ./deploy.sh + skip_cleanup: true + on: + branch: src diff --git a/deploy.sh b/deploy.sh index b90cfeb..0af0a61 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,27 +1,22 @@ #!/bin/bash -# This deploy script is from -# https://gohugo.io/hosting-and-deployment/hosting-on-github/#deployment-via-docs-folder-on-master-branch +set -e echo -e "\033[0;32mDeploying updates to GitHub...\033[0m" -# Build the project. -hugo -t devsec +echo $GITHUB_AUTH_SECRET > ~/.git-credentials && chmod 0600 ~/.git-credentials +git config --global credential.helper store +git config --global user.email "artem-bot@users.noreply.github.com" +git config --global user.name "Artems Bot" +git config --global push.default simple -# Go To Public folder -cd public -# Add changes to git. -git add . +rm -rf deployment +git clone -b master https://github.com/dev-sec/dev-sec.github.io.git deployment +rsync -av --delete --exclude ".git" public/ deployment +cd deployment +git add -A +git commit -m "rebuilding site on `date`, commit ${TRAVIS_COMMIT} and job ${TRAVIS_JOB_NUMBER}" +git push -# Commit changes. -msg="rebuilding site `date`" -if [ $# -eq 1 ] - then msg="$1" -fi -git commit -m "$msg" - -# Push source and build repos. -git push origin master - -# Come Back up to the Project Root -cd .. \ No newline at end of file +cd .. +rm -rf deployment From fe11aa6d5851d00eb3db296f1d9ad1be0ecc9fd2 Mon Sep 17 00:00:00 2001 From: Artem Sidorenko Date: Mon, 10 Dec 2018 23:36:48 +0100 Subject: [PATCH 4/4] Fix: commit can do exit 1 if there are no changes Lets avoid failing here Signed-off-by: Artem Sidorenko --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 0af0a61..fa39b25 100755 --- a/deploy.sh +++ b/deploy.sh @@ -15,7 +15,7 @@ git clone -b master https://github.com/dev-sec/dev-sec.github.io.git deployment rsync -av --delete --exclude ".git" public/ deployment cd deployment git add -A -git commit -m "rebuilding site on `date`, commit ${TRAVIS_COMMIT} and job ${TRAVIS_JOB_NUMBER}" +git commit -m "rebuilding site on `date`, commit ${TRAVIS_COMMIT} and job ${TRAVIS_JOB_NUMBER}" || true git push cd ..