Skip to content

Commit

Permalink
Deploy to marquee using GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
foolip committed Jun 10, 2020
1 parent 3374e69 commit c7b2a01
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 40 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: deploy
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/setup-node@v1
with:
node-version: 14
- run: pip install commonmark==0.9.1
- run: npm install
- run: shellcheck deploy.sh
- run: shellcheck resources.whatwg.org/build/*.sh
- run: bash ./deploy.sh
env:
SERVER: 165.227.248.76
SERVER_PUBLIC_KEY: ${{ secrets.MARQUEE_PUBLIC_KEY }}
SERVER_DEPLOY_KEY: ${{ secrets.MARQUEE_DEPLOY_KEY }}
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

19 changes: 4 additions & 15 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,12 @@ if [[ "$TRAVIS" == "true" ]]; then
fi

# This ensures that only changes to the master branch get deployed
if [[ "$TRAVIS_BRANCH" != "master" || "$TRAVIS_PULL_REQUEST" != "false" ]]; then
if [[ "$GITHUB_REF" != "refs/heads/master" ]]; then
header "Skipping deploy"
else
header "Synchronizing content with whatwg.org et al"
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K "$ENCRYPTED_KEY" -iv "$ENCRYPTED_IV" -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval "$(ssh-agent -s)"
ssh-add deploy_key
echo "$SERVER $SERVER_PUBLIC_KEY" > known_hosts
# --verbose isn't used because there are too many files to list them all
# without exceeding log size limits:
# https://github.com/whatwg/whatwg.org/issues/287
rsync --archive --chmod="D755,F644" --compress --delete --stats --log-file="rsync-log.txt" --rsh="ssh -o UserKnownHostsFile=known_hosts" ./whatwg.org ./*.whatwg.org "deploy@$SERVER:/var/www/"
scp -o="UserKnownHostsFile=known_hosts" rsync-log.txt "deploy@$SERVER:/var/www/whatwg.org/"
echo "Full rsync log at https://whatwg.org/rsync-log.txt"
echo "$SERVER_DEPLOY_KEY" | ssh-add -
mkdir -p ~/.ssh/ && echo "$SERVER $SERVER_PUBLIC_KEY" > ~/.ssh/known_hosts
rsync --archive --chmod="D755,F644" --compress --delete --verbose ./whatwg.org ./*.whatwg.org "deploy@$SERVER:/var/www/"
fi
Binary file removed deploy_key.enc
Binary file not shown.

0 comments on commit c7b2a01

Please sign in to comment.