Skip to content

Commit

Permalink
Run deploy.sh on PRs as well (#323)
Browse files Browse the repository at this point in the history
Also take this chance to simplify the TODO waiting for Bash 4.4. Ubuntu
20.04 appears to have Bash 5.

This regressed in #321.
  • Loading branch information
foolip authored Jun 11, 2020
1 parent 988c10c commit 2c14973
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: deploy
on:
pull_request:
branches:
- master
push:
branches:
- master
- master
jobs:
deploy:
runs-on: ubuntu-20.04
Expand Down
21 changes: 8 additions & 13 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,13 @@ copy_logo "samsung-internet/samsung-internet.svg" "samsung.svg"
copy_logo "uc/uc_32x32.png" "uc.png"
echo ""

# Run the HTML checker only when building on Travis
if [[ "$TRAVIS" == "true" ]]; then
# Run the HTML checker only when building on CI
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
header "Running the HTML checker..."

# Check the targets given explicitly here, plus most of the extensionless files directly inside
# whatwg.org/. This uses https://stackoverflow.com/a/23357277/3191 to get the results of the
# find command into an array. TODO: if Travis CI ever gets Bash 4.4, we can use the simpler
# version at https://stackoverflow.com/a/54561526/3191.
TARGETS=(whatwg.org/news whatwg.org/validator whatwg.org/index.html idea.whatwg.org/index.html spec.whatwg.org/index.html)
while IFS= read -r -d $'\0'; do
TARGETS+=("$REPLY")
done < <(find whatwg.org -maxdepth 1 -type f ! -name "*.*" ! -name "status-2008-12" -print0)
# Check most of the extensionless files in whatwg.org/, plus targets explicitly listed.
readarray -d '' TARGETS < <(find whatwg.org -maxdepth 1 -type f ! -name "*.*" ! -name "status-2008-12" -print0)
TARGETS+=(whatwg.org/news whatwg.org/validator whatwg.org/index.html idea.whatwg.org/index.html spec.whatwg.org/index.html)

curl --retry 2 --fail --remote-name --location https://github.com/validator/validator/releases/download/linux/vnu.linux.zip
unzip -qq vnu.linux.zip
Expand All @@ -62,13 +57,13 @@ if [[ "$TRAVIS" == "true" ]]; then
fi

# This ensures that only changes to the master branch get deployed
if [[ "$GITHUB_REF" != "refs/heads/master" ]]; then
header "Skipping deploy"
else
if [[ "$GITHUB_EVENT_NAME" == "push" && "$GITHUB_REF" == "refs/heads/master" ]]; then
header "Synchronizing content with whatwg.org et al"
eval "$(ssh-agent -s)"
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/"
else
header "Skipping deploy"
fi

0 comments on commit 2c14973

Please sign in to comment.