Skip to content

Commit 956b870

Browse files
authored
Push docs to github pages (#60)
* Create static.yml * Better doc page Signed-off-by: James Hamlin <[email protected]> * Temporarily allow pages from branch Signed-off-by: James Hamlin <[email protected]> * Disable env Signed-off-by: James Hamlin <[email protected]> * Build wasm Signed-off-by: James Hamlin <[email protected]> * Re-enable github-pages env Signed-off-by: James Hamlin <[email protected]> --------- Signed-off-by: James Hamlin <[email protected]>
1 parent 46f928d commit 956b870

File tree

4 files changed

+104
-4
lines changed

4 files changed

+104
-4
lines changed

.github/workflows/static.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Single deploy job since we're just deploying
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v3
36+
- uses: cachix/install-nix-action@v19
37+
with:
38+
nix_path: nixpkgs=channel:nixos-unstable
39+
- name: Build WASM
40+
run: nix-shell --run 'PATH=$(go env GOPATH)/bin:$PATH make bin/js_wasm/glj.wasm && cp bin/js_wasm/glj.wasm doc/repl/'
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v2
43+
with:
44+
# Upload entire repository
45+
path: './doc/'
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v2

doc/index.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!doctype html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Glojure</title>
7+
<script src="https://cdn.tailwindcss.com"></script>
8+
<script>
9+
window.onmessage = function(event) {
10+
if (event.data.type === "repl") {
11+
// Hide loading screen
12+
document.getElementById("loading").style.display = "none";
13+
}
14+
};
15+
</script>
16+
</head>
17+
18+
<body>
19+
<nav class="bg-white border-gray-200 dark:bg-gray-900">
20+
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
21+
<a href="https://github.com/glojurelang/glojure"
22+
class="flex items-center space-x-3 rtl:space-x-reverse">
23+
<img src="logo_small.webp"
24+
class="h-8 border-2 border-black rounded-full"
25+
alt="Glojure Logo" />
26+
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">Glojure</span>
27+
</a>
28+
</div>
29+
</nav>
30+
31+
<div class="mx-10">
32+
33+
<div class="relative"
34+
width="800px" height="500px">
35+
<div id="loading"
36+
class="absolute inset-0 h-full w-[800px] text-white flex flex-col justify-center align-center items-center">
37+
<img src="logo_small.webp"
38+
class="h-8 border-2 border-white rounded-full w-8 animate-spin"
39+
alt="Glojure Logo" />
40+
<p>Loading REPL...</p>
41+
<p class="text-sm">This may take a few seconds</p>
42+
</div>
43+
<iframe src="/repl" width="800px" height="500px" frameborder="0" />
44+
</div>
45+
46+
</div>
47+
48+
</body>
49+
50+
</html>

doc/logo_small.webp

96.3 KB
Loading

doc/repl/wasm_exec.html renamed to doc/repl/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<html>
33
<head>
44
<meta charset="utf-8">
5-
<title>Go wasm</title>
5+
<title>Glojure REPL</title>
6+
<script src="https://cdn.tailwindcss.com"></script>
67
<style>
78
#replContainer {
89
background-color: black;
@@ -12,12 +13,10 @@
1213
border-radius: 15px;
1314

1415
padding: 10px;
15-
margin: 10px 0;
16+
1617
font-family: monospace;
1718

1819
overflow-y: scroll;
19-
height: 500px;
20-
width: 800px;
2120
}
2221
#inputLine {
2322
background-color: black;
@@ -37,6 +36,7 @@
3736

3837
<body>
3938
<div id="replContainer"
39+
class="flex h-screen w-screen"
4040
onclick="document.getElementById('inputLine').focus()">
4141
<div id="output">
4242
<span id="inputLine" contenteditable="true" autocomplete="off" spellcheck="false"></span>
@@ -65,6 +65,8 @@
6565

6666
const decoder = new TextDecoder("utf-8");
6767
globalThis.fs.writeSync = function(fd, buf) {
68+
window.top.postMessage({ type: "repl", value: decoder.decode(buf) });
69+
6870
const output = document.getElementById("output");
6971
const text = decoder.decode(buf);
7072

0 commit comments

Comments
 (0)