Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Add common deploy script #41

Merged
merged 4 commits into from
Jan 24, 2017
Merged

Add common deploy script #41

merged 4 commits into from
Jan 24, 2017

Conversation

domenic
Copy link
Member

@domenic domenic commented Jan 23, 2017

Closes whatwg/meta#6 and closes whatwg/meta#9.

@domenic
Copy link
Member Author

domenic commented Jan 23, 2017

I am not sure why Travis was running here. I've turned it off for future pushes.

@@ -0,0 +1,44 @@
# Build resources

The resources in this folder are used for building WHATWG specifications.
Copy link
Member

@annevk annevk Jan 24, 2017

Choose a reason for hiding this comment

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

standards (throughout)

The `deploy.sh` script is used by most WHATWG specifications and is meant to run either on Travis CI, or locally with the `--local` command-line flag for preview purposes. It performs the following steps:

- Running [Bikeshed](https://github.com/tabatkins/bikeshed), through its [web API](https://api.csswg.org/bikeshed/), to produce:
- If on master, the built living standard, as well as a commit snapshot
Copy link
Member

Choose a reason for hiding this comment

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

Living Standard*

Similarly, a local deploy can be performed with

```bash
curl --remote-name --fail https://resources.whatwg.org/build/deploy.sh && bash ./deploy.sh --local
Copy link
Member

@annevk annevk Jan 24, 2017

Choose a reason for hiding this comment

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

Should we instead turn this into "make localdeploy"? A bit more duplication perhaps, but also easier to use.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's what I did, see https://github.com/whatwg/url/pull/205/files#diff-b67911656ef5d18c4ae36cb6741b7965R7 . But the idea is that this repo is just documenting how to use deploy.sh. If your consumer repo wants to use it via a Makefile it can.

Unless you think we should host the makefiles here too somehow?

Copy link
Member

Choose a reason for hiding this comment

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

Okay, I was a little unclear who these instructions are for, but this probably is the right tradeoff for now. We can't deduplicate Makefile as far as I know.

/usr/lib/jvm/java-8-oracle/jre/bin/java -jar vnu.jar --skip-non-html $WEB_ROOT
fi

if [ "$1" != "--local" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Can this not be combined with the previous if?

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 2>/dev/null || :
Copy link
Member

Choose a reason for hiding this comment

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

What is this doing exactly?

Copy link
Member

Choose a reason for hiding this comment

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

For whatwg/url in particular the .htaccess is actually important.

Copy link
Member Author

Choose a reason for hiding this comment

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

This copies .htaccess but ignores any errors. This was my best attempt at "copy .htaccess if it exists, otherwise don't bother."

I guess maybe instead i should do the equivalent of if (htaccess exists) { copy it }. The problem with that is that it's susceptible to race conditions where htaccess disappears or appears between the if and the copy. But that's not realistically a problem in this scenario so I guess it's fine.

If we have a repo with no other resources to test on then that might be better for first pass.

Copy link
Member

Choose a reason for hiding this comment

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

We can do DOM.

I was thinking for this we might want something like COPY_FILES_LIVING_ONLY=".htaccess". And for other cases such as Encoding we could have COPY_FILES="*.txt". Although I guess Encoding got even more complicated now it wants to run scripts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that is exactly what I was thinking.

@domenic
Copy link
Member Author

domenic commented Jan 24, 2017

OK, updated. No .htaccess for now. Also I removed --local; it will use $TRAVIS to determine local-vs-Travis deploy.

@@ -17,27 +17,27 @@ BRANCHES_DIR="branch-snapshots"
SERVER="75.119.197.251"
SERVER_PUBLIC_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDM6WJlvCc/+Zy2wrdzfKMv0Mb2Pmf9INvJPOH/zFrG5TbrKWY2LbNB6m3kkYTDQJzc0EuxCytuDsGhTuzTgc3drHwe2dys7cUQyQzS0iue50r6nBMfr1x2h6WhV3OZHkzFgqS17vlVdlLcGHCCwYgm19TGlrqY5RDnE+jTEAC/9AN7YFbbyfZV5fzToXwA2sFyj9TtwKfu/EeZAInPBpaLumu/glhr+rFXwhQQdNFh7hth8b4flG5mOqODju94wtbuDa4Utw1+S/zCeFIU55R7JHa29Pz3rL6Rpiiin9SpenjkD3UpP+y8WC1OaMImEh1XNUuomQa+6qxXEjxQAW1r"

if [ "$1" != "--local" -a "$DEPLOY_USER" == "" ]; then
echo "No deploy credentials present; skipping deploy"
if [ "$TRAVIS" == "true" -a "$TRAVIS_PULL_REQUEST" == "true" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

Note that in https://travis-ci.org/whatwg/whatwg.org/builds/194915312 it echoes "1" for TRAVIS_PULL_REQUEST. I do get "false" in https://travis-ci.org/whatwg/whatwg.org/builds/194915320. But maybe those are just all weird?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh wow.

TRAVIS_PULL_REQUEST: The pull request number if the current job is a pull request, “false” if it’s not a pull request.

from https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables

So the only applicable test is vs. "false"

@annevk
Copy link
Member

annevk commented Jan 24, 2017

LGTM to land this and see if that makes the DOM PR green. If that happens, LGTM to land that too.

@domenic domenic merged commit 585b6d9 into master Jan 24, 2017
@domenic domenic deleted the deploy-script branch January 24, 2017 18:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Stop commit snapshots for PRs Deduplicating deploy scripts
2 participants