diff --git a/.github/deploy.sh b/.github/deploy.sh new file mode 100755 index 000000000..10eb15b5d --- /dev/null +++ b/.github/deploy.sh @@ -0,0 +1,38 @@ +#!/bin/sh +set -e + +P="$(mktemp -d)" + +if [ "$encrypted_1671ba5f199a_key" ] +then + eval "$(ssh-agent -s)" + openssl aes-256-cbc -K $encrypted_1671ba5f199a_key -iv $encrypted_1671ba5f199a_iv \ + -in .github/deploy_key.enc -out .github/deploy_key -d + chmod 600 .github/deploy_key + ssh-add .github/deploy_key + + pip install git+https://github.com/spanezz/staticsite.git +fi + +[ -d $P ] && rm -Rfv $P +git clone --depth=10 --branch=gh-pages git@github.com:${TRAVIS_REPO_SLUG}.git $P + +ssite build + +rsync -r --del --verbose --exclude tests \ + --exclude dosagelib --exclude dist --exclude build --exclude scripts \ + ../*.site.out/* $P/ + +cd $P + +git config user.email 'nobody@23.gs' +git config user.name 'Travis-CI Website Bot' +git config push.default simple + +git add -A . +if [ "$TRAVIS_COMMIT" ] +then + git commit -a -m "Update website from commit $TRAVIS_COMMIT" + git push origin HEAD:gh-pages +fi + diff --git a/.github/deploy_key.enc b/.github/deploy_key.enc new file mode 100644 index 000000000..f7508de39 Binary files /dev/null and b/.github/deploy_key.enc differ diff --git a/.github/deploy_key.pub b/.github/deploy_key.pub new file mode 100644 index 000000000..90dd5482c --- /dev/null +++ b/.github/deploy_key.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG/I1J2fVYFzxQP7cZK32kI28cv94NH0xdq08OoIfwpz website-autodeploy diff --git a/.travis.yml b/.travis.yml index 82d4e9dad..78502ce93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,3 +25,10 @@ notifications: - "chat.freenode.net#dosage" use_notice: true skip_join: true +# Push site to gh-pages branch +deploy: + - provider: script + skip_cleanup: true + script: .github/deploy.sh + on: + branch: master