Skip to content

Commit e94c200

Browse files
committed
Fix GitHub Pages frontend deployment
1 parent 303b6d3 commit e94c200

4 files changed

Lines changed: 71 additions & 2 deletions

File tree

.github/workflows/deploy-pages.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Deploy Frontend to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- ".github/workflows/deploy-pages.yml"
9+
- "frontendcodes/**"
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: github-pages
19+
cancel-in-progress: false
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
defaults:
25+
run:
26+
working-directory: frontendcodes
27+
env:
28+
EXPO_PUBLIC_API_BASE_URL: ${{ vars.EXPO_PUBLIC_API_BASE_URL }}
29+
EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID: ${{ vars.EXPO_PUBLIC_GOOGLE_WEB_CLIENT_ID }}
30+
EXPO_PUBLIC_GOOGLE_IOS_CLIENT_ID: ${{ vars.EXPO_PUBLIC_GOOGLE_IOS_CLIENT_ID }}
31+
EXPO_PUBLIC_GOOGLE_ANDROID_CLIENT_ID: ${{ vars.EXPO_PUBLIC_GOOGLE_ANDROID_CLIENT_ID }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
35+
36+
- name: Setup Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 22
40+
cache: npm
41+
cache-dependency-path: frontendcodes/package-lock.json
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Build web app
47+
run: npm run build:web
48+
49+
- name: Add GitHub Pages fallback
50+
run: |
51+
cp dist/index.html dist/404.html
52+
touch dist/.nojekyll
53+
54+
- name: Upload Pages artifact
55+
uses: actions/upload-pages-artifact@v3
56+
with:
57+
path: frontendcodes/dist
58+
59+
deploy:
60+
needs: build
61+
runs-on: ubuntu-latest
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
steps:
66+
- name: Deploy to GitHub Pages
67+
id: deployment
68+
uses: actions/deploy-pages@v4

frontendcodes/app/home.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
44
import { Animated, Easing, Image, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
55
import { SafeAreaView } from 'react-native-safe-area-context';
66
import { useFocusEffect } from '@react-navigation/native';
7-
import { BookOpenTextIcon } from 'phosphor-react-native/lib/module/icons/BookOpenText';
7+
import { BookOpenTextIcon } from 'phosphor-react-native';
88
import { useAuth } from '@/context/auth-context';
99
import { Fonts } from '@/constants/theme';
1010
import {

frontendcodes/app/learn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
44
import { Animated, Easing, Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';
55
import { SafeAreaView } from 'react-native-safe-area-context';
66
import { useFocusEffect } from '@react-navigation/native';
7-
import { ChalkboardTeacherIcon } from 'phosphor-react-native/lib/module/icons/ChalkboardTeacher';
7+
import { ChalkboardTeacherIcon } from 'phosphor-react-native';
88
import { useAuth } from '@/context/auth-context';
99
import { Fonts } from '@/constants/theme';
1010
import { DAILY_GOAL_TARGET, getGoalPercent, getTodaySolvedCount, normalizeDailySolvedCounts } from '@/lib/daily-goal';

frontendcodes/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "1.0.0",
55
"scripts": {
66
"start": "expo start",
7+
"build:web": "expo export --platform web",
78
"reset-project": "node ./scripts/reset-project.js",
89
"android": "expo start --android",
910
"ios": "expo start --ios",

0 commit comments

Comments
 (0)