|
4 | 4 | # Determine if this is a tagged release |
5 | 5 | GITTAG=$(git tag --points-at HEAD) |
6 | 6 |
|
7 | | -# Build the specification document into publishable form |
8 | | -echo "Building spec" |
9 | | -mkdir -p out |
10 | | -if [ -n "$GITTAG" ]; then |
11 | | - spec-md --githubSource "https://github.com/graphql/graphql-spec/blame/$GITTAG/" spec/GraphQL.md > out/index.html |
12 | | -else |
13 | | - spec-md --githubSource "https://github.com/graphql/graphql-spec/blame/main/" spec/GraphQL.md > out/index.html |
14 | | -fi |
15 | | -npm run build > /dev/null 2>&1 |
16 | | - |
17 | | -# Check out gh-pages locally. |
18 | | -echo "Cloning gh-pages" |
19 | | -rm -rf gh-pages |
20 | | -git clone -b gh-pages "https://${GH_TOKEN}@github.com/graphql/graphql-spec.git" gh-pages > /dev/null 2>&1 |
| 7 | +# Build the specification draft document |
| 8 | +echo "Building spec draft" |
| 9 | +mkdir -p public/draft |
| 10 | +spec-md --githubSource "https://github.com/graphql/graphql-spec/blame/main/" spec/GraphQL.md > public/draft/index.html |
21 | 11 |
|
22 | | -# Replace /draft with this build. |
23 | | -echo "Publishing to: /draft" |
24 | | -rm -rf gh-pages/draft |
25 | | -cp -R out/ gh-pages/draft |
26 | | - |
27 | | -# If this is a tagged commit, publish to a permalink and index. |
| 12 | +# If this is a tagged commit, also build the release document |
28 | 13 | if [ -n "$GITTAG" ]; then |
29 | | - echo "Publishing to: /$GITTAG" |
30 | | - cp -R out/ "gh-pages/$GITTAG" |
| 14 | + echo "Building spec release $GITTAG" |
| 15 | + mkdir -p "public/$GITTAG" |
| 16 | + spec-md --githubSource "https://github.com/graphql/graphql-spec/blame/$GITTAG/" spec/GraphQL.md > "public/$GITTAG/index.html" |
31 | 17 | fi |
32 | 18 |
|
33 | 19 | # Create the index file |
@@ -116,17 +102,4 @@ HTML="$HTML |
116 | 102 | </body> |
117 | 103 | </html>" |
118 | 104 |
|
119 | | -echo $HTML > "gh-pages/index.html" |
120 | | - |
121 | | -echo "Pushing update" |
122 | | -cd gh-pages |
123 | | -git config user.name "Travis CI" |
124 | | -git config user.email "[email protected]" |
125 | | -git add -A . |
126 | | -if git diff --staged --quiet; then |
127 | | - echo "Nothing to publish" |
128 | | -else |
129 | | - git commit -a -m "Deploy to GitHub Pages" |
130 | | - git push > /dev/null 2>&1 |
131 | | - echo "Pushed" |
132 | | -fi |
| 105 | +echo $HTML > "public/index.html" |
0 commit comments