Skip to content

Commit 2c14973

Browse files
authored
Run deploy.sh on PRs as well (#323)
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.
1 parent 988c10c commit 2c14973

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
name: deploy
22
on:
3+
pull_request:
4+
branches:
5+
- master
36
push:
47
branches:
5-
- master
8+
- master
69
jobs:
710
deploy:
811
runs-on: ubuntu-20.04

deploy.sh

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,13 @@ copy_logo "samsung-internet/samsung-internet.svg" "samsung.svg"
4242
copy_logo "uc/uc_32x32.png" "uc.png"
4343
echo ""
4444

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

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

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

6459
# This ensures that only changes to the master branch get deployed
65-
if [[ "$GITHUB_REF" != "refs/heads/master" ]]; then
66-
header "Skipping deploy"
67-
else
60+
if [[ "$GITHUB_EVENT_NAME" == "push" && "$GITHUB_REF" == "refs/heads/master" ]]; then
6861
header "Synchronizing content with whatwg.org et al"
6962
eval "$(ssh-agent -s)"
7063
echo "$SERVER_DEPLOY_KEY" | ssh-add -
7164
mkdir -p ~/.ssh/ && echo "$SERVER $SERVER_PUBLIC_KEY" > ~/.ssh/known_hosts
7265
rsync --verbose --archive --chmod=D755,F644 --compress --delete \
7366
./whatwg.org ./*.whatwg.org "deploy@$SERVER:/var/www/"
67+
else
68+
header "Skipping deploy"
7469
fi

0 commit comments

Comments
 (0)