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: HUGO_ENV=staging hugo -v -s /root/project/ - 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 command: | ssh -p ${SSHPORT} ${USER_NAME}@${HOST_NAME} "rm -rf /var/www/test/*" rsync -e "ssh -p ${SSHPORT}" --omit-dir-times -avz --delete public/ ${USER_NAME}@${HOST_NAME}:/var/www/test