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

WIP review draft deploy #201

Merged
merged 14 commits into from
May 29, 2018
30 changes: 29 additions & 1 deletion resources.whatwg.org/build/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ LS_URL="https://$SHORTNAME.spec.whatwg.org/"
COMMIT_URL_BASE="https://github.com/whatwg/$SHORTNAME/commit/"
WEB_ROOT="$SHORTNAME.spec.whatwg.org"
COMMITS_DIR="commit-snapshots"
REVIEW_DRAFTS_DIR="review-drafts"

# Optional environment variables (won't be set for local deploys)
TRAVIS=${TRAVIS:-false}
Expand Down Expand Up @@ -111,6 +112,32 @@ run_post_build_step "$WEB_ROOT"
echo "Living standard output to $WEB_ROOT"
echo ""

header "Starting review drafts..."
echo "Note: review drafts must be added or changed in a single commit on master"
for f in "$REVIEW_DRAFTS_DIR"/*.bs; do
[ -e "$f" ] || continue # http://mywiki.wooledge.org/BashPitfalls#line-80
if [[ "$TRAVIS_PULL_REQUEST" == "true" ]]; then
CHANGED_FILES=$(git diff --name-only master..HEAD)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we put the DATE directly in the draft I don't think we need to distinguish between added and changed anymore. Hence we can simply use --name-only instead of --name-status.

I used master..HEAD here so a PR will consider all commits. We'll just have to ensure to land as a single commit on master.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

else
CHANGED_FILES=$(git diff --name-only HEAD~1)
fi
for change in $CHANGED_FILES; do # Omit quotes around variable to split on whitespace
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW we should probably stick to uppercase everywhere, I was just copying and pasting from places that did lowercase.

if [[ "$f" != "$change" ]]; then
continue
fi
echo ""
BASENAME=$(basename "$f" .bs)
DRAFT_DIR="$WEB_ROOT/$REVIEW_DRAFTS_DIR/$BASENAME"
mkdir -p "$DRAFT_DIR"
curlbikeshed -F md-Status="RD" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be whatwg/RD?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, since we're already in the WHATWG org, just the status suffices.

> "$DRAFT_DIR/index.html"
copy_extra_files "$DRAFT_DIR"
run_post_build_step "$DRAFT_DIR"
echo "Review draft output to $DRAFT_DIR"
done
done
echo ""

# Standard service worker and robots.txt
header "Getting the service worker hash..."
SERVICE_WORKER_SHA=$(curlretry https://resources.whatwg.org/standard-service-worker.js | shasum | cut -c 1-40)
Expand All @@ -133,7 +160,8 @@ importScripts(\"https://resources.whatwg.org/standard-service-worker.js\");
> "$WEB_ROOT/service-worker.js"
echo "User-agent: *
Disallow: /branch-snapshots/
Disallow: /commit-snapshots/" > "$WEB_ROOT/robots.txt"
Disallow: /commit-snapshots/
Disallow: /review-drafts/" > "$WEB_ROOT/robots.txt"
echo "Service worker and robots.txt output to $WEB_ROOT"
echo ""

Expand Down