Skip to content

Commit 3d1374d

Browse files
Copilotgfauredev
andcommitted
Add GitHub Actions workflow for GitHub Pages deployment
Co-authored-by: gfauredev <19304085+gfauredev@users.noreply.github.com>
1 parent a4167e5 commit 3d1374d

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Rust
25+
uses: actions-rs/toolchain@v1
26+
with:
27+
toolchain: stable
28+
target: wasm32-unknown-unknown
29+
override: true
30+
31+
- name: Install wasm-bindgen-cli
32+
run: cargo install wasm-bindgen-cli --version 0.2.108
33+
34+
- name: Build
35+
run: cargo build --target wasm32-unknown-unknown --release
36+
37+
- name: Generate bindings
38+
run: wasm-bindgen --target web --out-dir dist target/wasm32-unknown-unknown/release/logout.wasm
39+
40+
- name: Copy static files
41+
run: |
42+
cp index.html dist/
43+
cp sw.js dist/ || true
44+
# Fix the import path in index.html for GitHub Pages
45+
sed -i "s|import init from './dist/logout.js';|import init from './logout.js';|g" dist/index.html
46+
47+
- name: Setup Pages
48+
uses: actions/configure-pages@v4
49+
50+
- name: Upload artifact
51+
uses: actions/upload-pages-artifact@v3
52+
with:
53+
path: './dist'
54+
55+
deploy:
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
runs-on: ubuntu-latest
60+
needs: build
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,29 @@ A cross-platform workout logging application built with Dioxus 0.7. The app incl
77

88
- 🏋️ Browse 873+ exercises with search functionality
99
- 💪 Log workouts with sets, reps, and weights
10+
- 📊 **Analytics panel** with line charts to track progress over time
1011
- 📱 Mobile-first responsive design
1112
- 🌐 Cross-platform (Web, with Blitz support planned)
1213
- 💾 Exercise database downloaded and embedded at build time for optimal performance
1314
- 🖼️ Exercise images loaded from remote CDN with lazy loading
1415
- 🎨 Modern, gradient-based UI
1516
- 🔌 **Blitz-Ready**: Can run without JavaScript for native platforms
1617

18+
## GitHub Pages Deployment
19+
20+
The app can be deployed to GitHub Pages automatically via GitHub Actions.
21+
22+
### Setup
23+
24+
1. Go to your repository Settings → Pages
25+
2. Under "Build and deployment", select "GitHub Actions" as the source
26+
3. Push to the `main` branch to trigger deployment
27+
28+
The workflow will automatically:
29+
- Build the Rust WASM binary
30+
- Generate JavaScript bindings
31+
- Deploy to GitHub Pages
32+
1733
## Building
1834

1935
### Prerequisites
@@ -32,7 +48,15 @@ cargo build --target wasm32-unknown-unknown --release
3248
# Generate wasm bindings
3349
wasm-bindgen --target web --out-dir dist target/wasm32-unknown-unknown/release/logout.wasm
3450

51+
# Copy static files to dist
52+
cp index.html dist/
53+
cp sw.js dist/
54+
55+
# Fix import path in index.html (change './dist/logout.js' to './logout.js')
56+
sed -i "s|import init from './dist/logout.js';|import init from './logout.js';|g" dist/index.html
57+
3558
# Serve the app (requires a local web server)
59+
cd dist
3660
python3 -m http.server 8000
3761
# Then open http://localhost:8000 in your browser
3862
```

0 commit comments

Comments
 (0)