You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: web/README.md
+61-1
Original file line number
Diff line number
Diff line change
@@ -88,4 +88,64 @@ cd web
88
88
python3 -m http.server 8000
89
89
```
90
90
91
-
Once the server is up and running all you need to do now is go to [localhost](http://localhost:8000/index.html)
91
+
Once the server is up and running all you need to do now is go to [localhost](http://localhost:8000/index.html).
92
+
There you can locally develop your application without having to do any git commits or actions shenanigans.
93
+
94
+
# Deploying to Github Pages
95
+
96
+
For a free, quick and easy hosting solution you can realistically deploy this anywhere.
97
+
However for now we will only focus on putting this up via github pages.
98
+
99
+
What you need in your repository is a `.github/workflows/static.yml` file.
100
+
It can be named anything `static`, `ci`, whatever. Later on if you learn more about CI Pipelines you can use this to do a lot of useful things.
101
+
102
+
## Enabling github pages
103
+
Follow this step: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow
104
+
105
+
Once selected, you need to commit an actions file.
106
+
For now you can copy paste MLX42's `wasm.yml` file which functionally does the exact same.
107
+
```yml
108
+
# Simple workflow for deploying static content to GitHub Pages
109
+
name: Deploy static content to Pages
110
+
111
+
on:
112
+
push:
113
+
branches: ["master"] # Change to main or whatever fancy name
114
+
workflow_dispatch:
115
+
116
+
permissions:
117
+
contents: read
118
+
pages: write
119
+
id-token: write
120
+
121
+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
122
+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
123
+
concurrency:
124
+
group: "pages"
125
+
cancel-in-progress: false
126
+
127
+
# Single deploy job since we're just deploying
128
+
jobs:
129
+
deploy:
130
+
environment:
131
+
name: github-pages
132
+
url: ${{ steps.deployment.outputs.page_url }}
133
+
runs-on: ubuntu-latest
134
+
#TODO: add a build step to get the wasm file instead of commiting it.
135
+
#Doesn't really matter atm since the git history is polluted anyway
136
+
steps:
137
+
- name: Checkout
138
+
uses: actions/checkout@v4
139
+
- name: Setup Pages
140
+
uses: actions/configure-pages@v5
141
+
- name: Upload artifact
142
+
uses: actions/upload-pages-artifact@v3
143
+
with:
144
+
path: './web'
145
+
- name: Deploy to GitHub Pages
146
+
id: deployment
147
+
uses: actions/deploy-pages@v4
148
+
```
149
+
150
+
Once you commit this file github will do it's magic and create a deployment.
151
+
You should then get a link to where you can access you program. Now you can access your app anywhere!
0 commit comments