diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9977679 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,60 @@ +version: 2 +jobs: + build: + docker: + - image: cibuilds/hugo:latest + + steps: + - checkout + - run: + name: Change Amazon Links + working_directory: /root/project/ + command: | + set +o pipefail + grep -l -r ecx.images-amazon.com content/ | sort | uniq | xargs -t --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g" + grep -l -r "http://www.amazon.co.jp/exec" content/ | sort | uniq | xargs -t --no-run-if-empty sed -i -e "s/http:\/\/www.amazon.co.jp\/exec/https:\/\/www.amazon.co.jp\/exec/g" + + - run: + name: "Run Hugo" + working_directory: /root/project/ + command: | + if [ "${CIRCLE_BRANCH}" == "master" ]; then + hugo -e staging -v -s /root/project/ + else + hugo -e production -v -s /root/project/ + fi + + - run: + name: Change Amazon Links + working_directory: /root/project/ + command: | + set +o pipefail + grep -l -r ecx.images-amazon.com content/ | sort | uniq | xargs -t --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g" + + - run: + name: "Gzip css/js/images" + working_directory: /root/project/ + command: | + for TARGET in `find public/ -type f | egrep "\.(css|js|png|jpg|JPG|PNG|CSS|JS)$"` + do + gzip -c ${TARGET} > ${TARGET}.gz + done + + - add_ssh_keys: + fingerprints: + - "7d:eb:56:da:3f:71:e1:fd:2f:c1:86:18:fe:08:8b:f9" + - run: + name: Start ssh-keyscan + command: | + ssh-keyscan -p ${SSHPORT} ${HOST_NAME} >> ~/.ssh/known_hosts + + - run: + name: Deploy (Not Master) + command: | + if [ "${CIRCLE_BRANCH}" != "master" ]; then + ssh -p ${SSHPORT} ${USER_NAME}@${HOST_NAME} "rm -rf /var/www/test/*" + rsync -e "ssh -p ${SSHPORT}" --omit-dir-times -rltvz --delete public/ ${USER_NAME}@${HOST_NAME}:/var/www/test + else + ssh -p ${SSHPORT} ${USER_NAME}@${HOST_NAME} "rm -rf /var/www/blog/*" + rsync -e "ssh -p ${SSHPORT}" --omit-dir-times -rltvz --delete public/ ${USER_NAME}@${HOST_NAME}:/var/www/blog + fi diff --git a/config.toml b/config/_default/config.toml similarity index 100% rename from config.toml rename to config/_default/config.toml diff --git a/config/staging/config.toml b/config/staging/config.toml new file mode 100644 index 0000000..3e4b4ed --- /dev/null +++ b/config/staging/config.toml @@ -0,0 +1,13 @@ +baseurl = "http://test.kazu634.com/" +title = "His greatness lies in his sense of responsibility" +languageCode = "ja" +theme = "angels-ladder" + +[params] + subtitle = "I wanna be a Jedi Padawan." + facebook = "https://www.facebook.com/kazu634" + twitter = "https://twitter.com/kazu634" + github = "https://github.com/kazu634" + profile = "/images/profile.png" + analytics = "UA-57665492-1" + copyright = "Written by Kazuhiro MUSASHI" diff --git a/layouts/partials/sections-definition.html b/layouts/partials/sections-definition.html index 22f27d6..51c6e62 100644 --- a/layouts/partials/sections-definition.html +++ b/layouts/partials/sections-definition.html @@ -1,3 +1,3 @@ -