diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..d61ded09 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_size = 1 +indent_style = space +trim_trailing_whitespace = true +max_line_length = 100 + +[Makefile] +indent_style = tab + +[.travis.yml] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..33497b41 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto eol=lf +*.bs diff=html linguist-language=HTML diff --git a/.gitignore b/.gitignore index c384aee9..70e70958 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ deploy_key deploy_key.pub url.html +deploy.sh diff --git a/.travis.yml b/.travis.yml index 6e2a6a5e..b89326a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,16 +2,12 @@ language: generic env: global: - - ENCRYPTION_LABEL: "82f6fcb5a224" -addons: - apt: - packages: - - oracle-java8-set-default -install: - - curl -O https://sideshowbarker.net/nightlies/jar/vnu.jar + - ENCRYPTION_LABEL="82f6fcb5a224" + - DEPLOY_USER="annevankesteren" + script: - - bash ./deploy.sh - - /usr/lib/jvm/java-8-oracle/jre/bin/java -jar vnu.jar --skip-non-html /home/travis/build/whatwg/url + - curl --remote-name --fail https://resources.whatwg.org/build/deploy.sh && bash ./deploy.sh + notifications: email: on_success: never diff --git a/Makefile b/Makefile index cf0b16a9..31ffaecc 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,6 @@ local: url.bs remote: url.bs curl https://api.csswg.org/bikeshed/ -f -F file=@url.bs > url.html -F md-Text-Macro="SNAPSHOT-LINK LOCAL COPY" + +deploy: url.bs + curl --remote-name --fail https://resources.whatwg.org/build/deploy.sh && bash ./deploy.sh --local diff --git a/README.md b/README.md index fd355f0a..8017411e 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,7 @@ If you want to preview the spec locally, you can either use a locally installed running `make remote`. If you want to do a complete "local deploy" including commit and/or branch snapshots, run - -``` -./deploy.sh --local -``` +`make deploy`. ### Merge policy diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index 914d3101..00000000 --- a/deploy.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash -set -e - -DEPLOY_USER="annevankesteren" - -TITLE="URL Standard" -LS_URL="https://url.spec.whatwg.org/" -COMMIT_URL_BASE="https://github.com/whatwg/url/commit/" -BRANCH_URL_BASE="https://github.com/whatwg/url/tree/" - -INPUT_FILE="url.bs" -SERVER="url.spec.whatwg.org" -WEB_ROOT="url.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="Go to the living standard" -SNAPSHOT_LINK="Snapshot as of this commit" - -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 - cp .htaccess $WEB_ROOT/.htaccess - 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