Skip to content

Commit 1cdc3fc

Browse files
authored
Configure spec-md tooling and set up GitHub publish workflow (#189)
1 parent 00695ab commit 1cdc3fc

File tree

9 files changed

+4264
-50
lines changed

9 files changed

+4264
-50
lines changed

.github/workflows/ci.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v1
15+
with:
16+
node-version: "16.x"
17+
- run: npm ci
18+
- run: npm test
19+
publish:
20+
if: github.ref == 'refs/heads/main'
21+
needs: test
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v2
25+
with:
26+
fetch-depth: 0
27+
- uses: actions/setup-node@v1
28+
with:
29+
node-version: "16.x"
30+
- run: npm ci
31+
- run: npm run build
32+
- uses: peaceiris/actions-gh-pages@v3
33+
with:
34+
github_token: ${{ secrets.GITHUB_TOKEN }}
35+
keep_files: true
36+
user_name: "github-actions[bot]"
37+
user_email: "github-actions[bot]@users.noreply.github.com"

.github/workflows/prettier.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Prettier formatting
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: actions/setup-node@v1
10+
with:
11+
node-version: "16.x"
12+
- run: npm ci
13+
- run: npm run format:check

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,3 @@ npm-debug.log
7070
/public
7171
/gh-pages
7272
yarn.lock
73-
package-lock.json

build.sh

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/bash -e
2+
# This script publishes the GraphQL specification document to the web.
3+
4+
# Determine if this is a tagged release
5+
GITTAG=$(git tag --points-at HEAD)
6+
7+
# Build the specification draft document
8+
echo "Building spec draft"
9+
mkdir -p public/draft
10+
spec-md --metadata spec/metadata.json --githubSource "https://github.com/graphql/graphql-over-http/blame/main/" spec/GraphQLOverHTTP.md > public/draft/index.html
11+
12+
# If this is a tagged commit, also build the release document
13+
if [ -n "$GITTAG" ]; then
14+
echo "Building spec release $GITTAG"
15+
mkdir -p "public/$GITTAG"
16+
spec-md --metadata spec/metadata.json --githubSource "https://github.com/graphql/graphql-over-http/blame/$GITTAG/" spec/GraphQLOverHTTP.md > "public/$GITTAG/index.html"
17+
fi
18+
19+
# Create the index file
20+
echo "Rebuilding: / (index)"
21+
HTML="<html>
22+
<head>
23+
<title>GraphQL over HTTP Specification Versions</title>
24+
<style>
25+
body {
26+
color: #333333;
27+
font: 13pt/18pt Cambria, 'Palatino Linotype', Palatino, 'Liberation Serif', serif;
28+
margin: 6rem auto 3rem;
29+
max-width: 780px;
30+
}
31+
@media (min-width: 1240px) {
32+
body {
33+
padding-right: 300px;
34+
}
35+
}
36+
a {
37+
color: #3B5998;
38+
text-decoration: none;
39+
}
40+
a:hover {
41+
text-decoration: underline;
42+
}
43+
h1 {
44+
font-size: 1.5em;
45+
margin: 8rem 0 2em;
46+
}
47+
td {
48+
padding-bottom: 5px;
49+
}
50+
td + td {
51+
padding-left: 2ch;
52+
}
53+
</style>
54+
</head>
55+
<body>
56+
<h1>GraphQL over HTTP</h1>
57+
<table>"
58+
59+
# Include latest draft
60+
GITDATE=$(git show -s --format=%cd --date=format:"%a, %b %-d, %Y" HEAD)
61+
HTML="$HTML
62+
<tr>
63+
<td><em>Prerelease</em></td>
64+
<td><a href=\"./draft\" keep-hash>Working Draft</a></td>
65+
<td>$GITDATE</td>
66+
<td></td>
67+
</tr>"
68+
69+
GITHUB_RELEASES="https://github.com/graphql/graphql-over-http/releases/tag"
70+
for GITTAG in $(git tag -l --sort='-*committerdate') ; do
71+
VERSIONYEAR=${GITTAG: -4}
72+
TAGTITLE="${GITTAG%$VERSIONYEAR} $VERSIONYEAR"
73+
TAGGEDCOMMIT=$(git rev-list -1 "$GITTAG")
74+
GITDATE=$(git show -s --format=%cd --date=format:"%a, %b %-d, %Y" $TAGGEDCOMMIT)
75+
76+
HTML="$HTML
77+
<tr>"
78+
79+
[ -z $HAS_LATEST_RELEASE ] && HTML="$HTML
80+
<td><em>Latest Release</em></td>" || HTML="$HTML
81+
<td></td>"
82+
HAS_LATEST_RELEASE=1
83+
84+
HTML="$HTML
85+
<td><a href=\"./$GITTAG\" keep-hash>$TAGTITLE</a></td>
86+
<td>$GITDATE</td>
87+
<td><a href=\"$GITHUB_RELEASES/$GITTAG\">Release Notes</a></td>
88+
</tr>"
89+
done
90+
91+
HTML="$HTML
92+
</table>
93+
<script>
94+
var links = document.getElementsByTagName('a');
95+
for (var i = 0; i < links.length; i++) {
96+
if (links[i].hasAttribute('keep-hash')) {
97+
links[i].href += location.hash;
98+
links[i].removeAttribute('keep-hash');
99+
}
100+
}
101+
</script>
102+
</body>
103+
</html>"
104+
105+
echo $HTML > "public/index.html"

cspell.yml

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ ignoreRegExpList:
44
- /[a-z]{2,}'s/
55
words:
66
# Terms of art
7+
- roadmap
78
- endianness
89
- interoperation
910
- monospace
@@ -13,4 +14,8 @@ words:
1314
- subselection
1415
# Software
1516
- ical
17+
- WebDAV
18+
# Deliberate typos
19+
- qeury
20+
- __typena
1621
# Fictional characters / examples

0 commit comments

Comments
 (0)