Skip to content

Commit e098bd3

Browse files
authored
Publish stable permalinks (#364)
* Publish stable permalinks This adds a script which amends to the gh-pages repo rather than replacing it, keeping a latest copy at /draft, and redirecting index to the latest released copy of the spec. * Add link to previous releases * Fix remaining issues * Included all changed in final commit
1 parent a928aa9 commit e098bd3

File tree

6 files changed

+71
-7
lines changed

6 files changed

+71
-7
lines changed

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
*~
33
.*.haste_cache.*
44
.DS_Store
5-
build
6-
out
7-
node_modules
85
npm-debug.log
6+
/build
7+
/out
8+
/gh-pages
9+
/node_modules

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ node_js: 6
77
deploy:
88
provider: script
99
skip_cleanup: true
10-
script: npm run deploy
10+
script: ./publish.sh
1111
on:
1212
branch: master
1313

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# GraphQL
22

3+
The GraphQL specification is edited in the markdown files found in [`/spec`](./spec)
4+
the latest release of which is published at http://facebook.github.io/graphql/.
5+
6+
The latest draft specification can be found at http://facebook.github.io/graphql/draft/
7+
which tracks the latest commit to the master branch in this repository.
8+
9+
Previous releases of the GraphQL specification can be found at permalinks that
10+
match their [release tag](https://github.com/facebook/graphql/releases). For
11+
example, https://github.com/facebook/graphql/October2016. If you are linking
12+
directly to the GraphQL specification, it's best to link to a tagged permalink
13+
for the particular referenced version.
14+
15+
## Overview
16+
317
This is a Working Draft of the Specification for GraphQL, a query language for APIs created by Facebook.
418

519
The target audience for this specification is not the client developer, but those who have,

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
},
1818
"scripts": {
1919
"test": "spec-md spec/GraphQL.md > /dev/null",
20-
"build": "mkdir -p out; spec-md spec/GraphQL.md > out/index.html",
21-
"deploy": "npm run build && (cd out && git init && git config user.name \"Travis CI\" && git config user.email \"[email protected]\" && git add . && git commit -m \"Deploy to GitHub Pages\" && git push --force --quiet \"https://${GH_TOKEN}@github.com/facebook/graphql.git\" master:gh-pages > /dev/null 2>&1)"
20+
"build": "mkdir -p out; spec-md spec/GraphQL.md > out/index.html"
2221
},
2322
"devDependencies": {
2423
"spec-md": "0.5.1"

publish.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash -e
2+
# This script publishes the GraphQL specification document to the web.
3+
4+
# Build the specification document into publishable form
5+
echo "Building spec"
6+
npm run build > /dev/null 2>&1
7+
8+
# Determine if this is a tagged release
9+
GITTAG=$(git tag --points-at HEAD)
10+
11+
# Check out gh-pages locally.
12+
echo "Cloning gh-pages"
13+
rm -rf gh-pages
14+
git clone -b gh-pages "https://${GH_TOKEN}@github.com/facebook/graphql.git" gh-pages > /dev/null 2>&1
15+
pushd gh-pages > /dev/null 2>&1
16+
17+
# Replace /draft with this build.
18+
echo "Publishing to: /draft"
19+
rm -rf draft
20+
cp -r ../out/ draft
21+
22+
# If this is a tagged commit, publish to a permalink and index.
23+
if [ -n "$GITTAG" ]; then
24+
echo "Publishing to: /$GITTAG"
25+
cp -r ../out/ "$GITTAG"
26+
27+
echo "Linking from: / (index)"
28+
echo '<html>
29+
<head>
30+
<meta http-equiv="refresh" content="0; url=./'"$GITTAG"'" />
31+
<title>GraphQL Specification</title>
32+
</head>
33+
<body>
34+
Redirecting to the latest release: <a href="./'"$GITTAG"'">'"$GITTAG"'</a>
35+
</body>
36+
</html>' > index.html
37+
fi
38+
39+
echo "Pushing update"
40+
git config user.name "Travis CI"
41+
git config user.email "[email protected]"
42+
git add -A .
43+
git commit -a -m "Deploy to GitHub Pages"
44+
git push > /dev/null 2>&1
45+
46+
echo "Pushed"
47+
popd > /dev/null 2>&1

spec/GraphQL.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ for client-server applications. The development of this standard started
1111
in 2015. GraphQL is a new and evolving language and is not complete. Significant
1212
enhancement will continue in future editions of this specification.
1313

14+
Previous releases of the GraphQL specification can be found at permalinks that
15+
match their [release tag](https://github.com/facebook/graphql/releases).
16+
1417
**Copyright notice**
1518

1619
Copyright (c) 2015-2017, Facebook, Inc. All rights reserved.
@@ -43,7 +46,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4346

4447
**Conformance**
4548

46-
A conforming implementation of GraphQL must fulfill all normative requirements.
49+
A conforming implementation of GraphQL must fulfill all normative requirements.
4750
Conformance requirements are described in this document via both
4851
descriptive assertions and key words with clearly defined meanings.
4952

0 commit comments

Comments
 (0)