Skip to content

Commit b007f34

Browse files
committed
feat: add GitHub Actions workflow for automatic deployment to GitHub Pages; update README.md with deployment instructions and create docs/README.md for game setup
1 parent f9af333 commit b007f34

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Setup Emscripten
25+
uses: mymindstorm/setup-emsdk@v12
26+
with:
27+
version: 'latest'
28+
29+
- name: Install dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y autoconf automake libtool pkg-config
33+
34+
- name: Build
35+
run: |
36+
autoreconf -fiv
37+
emconfigure ./configure --enable-emscripten
38+
emmake make -j4 -k
39+
40+
- name: Setup Pages
41+
uses: actions/configure-pages@v4
42+
43+
- name: Upload artifact
44+
uses: actions/upload-pages-artifact@v3
45+
with:
46+
path: src
47+
48+
deploy:
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
runs-on: ubuntu-latest
53+
needs: build
54+
steps:
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4
58+

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,35 @@ Open `http://localhost:8000/chocolate-doom.html` in your browser.
3939

4040
**Note**: You need a WAD file (e.g., `doom1.wad`, `doom2.wad`) to play. Modify `index.html`'s `preRun` section to preload your WAD file.
4141

42+
## Deploy to GitHub Pages
43+
44+
This project includes a GitHub Actions workflow that automatically builds and deploys to GitHub Pages.
45+
46+
### Setup
47+
48+
1. **Enable GitHub Pages** in your repository settings:
49+
- Go to Settings → Pages
50+
- Source: Select "GitHub Actions"
51+
52+
2. **Push to main/master branch** - The workflow will automatically:
53+
- Build the project with Emscripten
54+
- Deploy to GitHub Pages
55+
- Your site will be available at `https://<username>.github.io/ascii-doom/`
56+
57+
### Manual Deployment
58+
59+
If you want to deploy manually:
60+
61+
```bash
62+
# Build the project
63+
autoreconf -fiv
64+
emconfigure ./configure --enable-emscripten
65+
emmake make -j4 -k
66+
67+
# Copy files to docs/ directory (if using docs/ folder for Pages)
68+
# Or push src/ directory contents to gh-pages branch
69+
```
70+
4271
## Troubleshooting
4372

4473
- **Build fails with "No rule to make target"**: Run `autoreconf -fiv` first

docs/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Chocolate Doom Web
2+
3+
Play Chocolate Doom in your browser!
4+
5+
## Games
6+
7+
- [Doom](chocolate-doom.html)
8+
- [Heretic](chocolate-heretic.html)
9+
- [Hexen](chocolate-hexen.html)
10+
- [Strife](chocolate-strife.html)
11+
12+
## Setup
13+
14+
You need a WAD file to play. Click on a game above and upload your WAD file when prompted.
15+

0 commit comments

Comments
 (0)