Skip to content

Commit

Permalink
Meta: enable snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed Jan 13, 2017
1 parent 59574a4 commit 8130c44
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 538 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/fullscreen.spec.whatwg.org/
deploy_key
deploy_key.pub
fullscreen.html
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: generic

env:
global:
- ENCRYPTION_LABEL: "f5b0eb183bc9"
addons:
apt:
packages:
- oracle-java8-set-default
install:
- curl -O https://sideshowbarker.net/nightlies/jar/vnu.jar
script:
- bash ./deploy.sh
- /usr/lib/jvm/java-8-oracle/jre/bin/java -jar vnu.jar --skip-non-html /home/travis/build/whatwg/fullscreen
notifications:
email:
on_success: never
on_failure: always
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local: fullscreen.bs
bikeshed
bikeshed spec fullscreen.bs fullscreen.html --md-Text-Macro="SNAPSHOT-LINK LOCAL COPY"

remote: fullscreen.bs
curl https://api.csswg.org/bikeshed/ -f -F [email protected] > fullscreen.html
curl https://api.csswg.org/bikeshed/ -f -F [email protected] > fullscreen.html -F md-Text-Macro="SNAPSHOT-LINK LOCAL COPY"
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ If you want to preview the spec locally, you can either use a locally installed
[Bikeshed](https://github.com/tabatkins/bikeshed) by running `make` or use the HTTP API version by
running `make remote`.

If you want to do a complete "local deploy" including commit and/or branch snapshots, run

```
./deploy.sh --local
```

### Merge policy

If you can commit to this repository, see the
Expand Down
93 changes: 93 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#!/bin/bash
set -e

DEPLOY_USER="annevankesteren"

TITLE="Fullscreen API Standard"
LS_URL="https://fullscreen.spec.whatwg.org/"
COMMIT_URL_BASE="https://github.com/whatwg/fullscreen/commit/"
BRANCH_URL_BASE="https://github.com/whatwg/fullscreen/tree/"

INPUT_FILE="fullscreen.bs"
SERVER="fullscreen.spec.whatwg.org"
WEB_ROOT="fullscreen.spec.whatwg.org"
COMMITS_DIR="commit-snapshots"
BRANCHES_DIR="branch-snapshots"

if [ "$1" != "--local" -a "$DEPLOY_USER" == "" ]; then
echo "No deploy credentials present; skipping deploy"
exit 0
fi

if [ "$1" == "--local" ]; then
echo "Running a local deploy into $WEB_ROOT directory"
echo ""
fi

SHA="`git rev-parse HEAD`"
BRANCH="`git rev-parse --abbrev-ref HEAD`"
if [ "$BRANCH" == "HEAD" ]; then # Travis does this for some reason
BRANCH=$TRAVIS_BRANCH
fi

if [ "$BRANCH" == "master" -a "$TRAVIS_PULL_REQUEST" != "false" -a "$TRAVIS_PULL_REQUEST" != "" ]; then
echo "Skipping deploy for a pull request; the branch build will suffice"
exit 0
fi

BACK_TO_LS_LINK="<a href=\"/\" id=\"commit-snapshot-link\">Go to the living standard</a>"
SNAPSHOT_LINK="<a href=\"/commit-snapshots/$SHA/\" id=\"commit-snapshot-link\">Snapshot as of this commit</a>"

echo "Branch = $BRANCH"
echo "Commit = $SHA"
echo ""

rm -rf $WEB_ROOT || exit 0

# Commit snapshot
COMMIT_DIR=$WEB_ROOT/$COMMITS_DIR/$SHA
mkdir -p $COMMIT_DIR
curl https://api.csswg.org/bikeshed/ -f -F file=@$INPUT_FILE -F md-status=LS-COMMIT \
-F md-warning="Commit $SHA $COMMIT_URL_BASE$SHA replaced by $LS_URL" \
-F md-title="$TITLE (Commit Snapshot $SHA)" \
-F md-Text-Macro="SNAPSHOT-LINK $BACK_TO_LS_LINK" \
> $COMMIT_DIR/index.html;
echo "Commit snapshot output to $WEB_ROOT/$COMMITS_DIR/$SHA"
echo ""

if [ $BRANCH != "master" ] ; then
# Branch snapshot, if not master
BRANCH_DIR=$WEB_ROOT/$BRANCHES_DIR/$BRANCH
mkdir -p $BRANCH_DIR
curl https://api.csswg.org/bikeshed/ -f -F file=@$INPUT_FILE -F md-status=LS-BRANCH \
-F md-warning="Branch $BRANCH $BRANCH_URL_BASE$BRANCH replaced by $LS_URL" \
-F md-title="$TITLE (Branch Snapshot $BRANCH)" \
-F md-Text-Macro="SNAPSHOT-LINK $SNAPSHOT_LINK" \
> $BRANCH_DIR/index.html;
echo "Branch snapshot output to $WEB_ROOT/$BRANCHES_DIR/$BRANCH"
else
# Living standard, if master
curl https://api.csswg.org/bikeshed/ -f -F file=@$INPUT_FILE \
-F md-Text-Macro="SNAPSHOT-LINK $SNAPSHOT_LINK" \
> $WEB_ROOT/index.html
echo "Living standard output to $WEB_ROOT"
fi

echo ""
find $WEB_ROOT -print
echo ""

if [ "$1" != "--local" ]; then
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
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

# scp the output directory up
scp -r -o StrictHostKeyChecking=no $WEB_ROOT $DEPLOY_USER@$SERVER:
fi
Binary file added deploy_key.enc
Binary file not shown.
2 changes: 2 additions & 0 deletions fullscreen.bs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ Boilerplate: omit feedback-header, omit conformance, omit index, omit idl-index
!Participate: <a href=https://github.com/whatwg/fullscreen>GitHub whatwg/fullscreen</a> (<a href=https://github.com/whatwg/fullscreen/issues/new>file an issue</a>, <a href=https://github.com/whatwg/fullscreen/issues>open issues</a>)
!Participate: <a href=https://wiki.whatwg.org/wiki/IRC>IRC: #whatwg on Freenode</a>
!Commits: <a href=https://github.com/whatwg/fullscreen/commits>GitHub whatwg/fullscreen/commits</a>
!Commits: [SNAPSHOT-LINK]
!Commits: <a href=https://twitter.com/fullscreenapi>@fullscreenapi</a>
</pre>

<script src=https://resources.whatwg.org/file-issue.js async></script>
<script src=https://resources.whatwg.org/commit-snapshot-shortcut-key.js async></script>
<script src=https://resources.whatwg.org/dfn.js defer></script>

<pre class=link-defaults>
Expand Down
Loading

0 comments on commit 8130c44

Please sign in to comment.