Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to marquee using GitHub actions #321

Merged
merged 3 commits into from
Jun 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: ${{ secrets.MARQUEE_SERVER }}
SERVER_PUBLIC_KEY: ${{ secrets.MARQUEE_PUBLIC_KEY }}
SERVER_DEPLOY_KEY: ${{ secrets.MARQUEE_DEPLOY_KEY }}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
deploy_key
deploy_key.pub

# Keep this list synchronized with https://github.com/whatwg/sg/blob/master/policy-link-mapping.txt
whatwg.org/ipr-policy
whatwg.org/workstream-policy
Expand Down
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

20 changes: 5 additions & 15 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,13 @@ 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 --verbose --archive --chmod=D755,F644 --compress --delete \
./whatwg.org ./*.whatwg.org "deploy@$SERVER:/var/www/"
fi
Binary file removed deploy_key.enc
Binary file not shown.