Skip to content

Commit c674f74

Browse files
committed
feat: web deployment workflow
1 parent 5c4ab8c commit c674f74

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/deploy_web.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Deploy Cooketh Flow Web
2+
3+
on:
4+
push:
5+
branches:
6+
- rewrite
7+
pull_request:
8+
branches:
9+
- rewrite
10+
types:
11+
- closed
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
build-and-deploy:
18+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Set up Flutter
26+
uses: subosito/flutter-action@v2
27+
with:
28+
flutter-version: '3.29.2'
29+
channel: 'stable'
30+
31+
- name: Enable web support
32+
run: flutter config --enable-web
33+
34+
- name: Check Flutter setup
35+
run: flutter doctor
36+
37+
- name: Install dependencies
38+
run: flutter pub get
39+
40+
- name: Debug environment variables
41+
run: |
42+
echo "SUPABASE_URL is set: ${{ secrets.SUPABASE_URL != '' }}"
43+
echo "SUPABASE_KEY is set: ${{ secrets.SUPABASE_KEY != '' }}"
44+
env:
45+
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
46+
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
47+
48+
- name: Build web
49+
run: flutter build web --release --no-source-maps --dart-define="SUPABASE_URL=${{ secrets.SUPABASE_URL }}" --dart-define="SUPABASE_KEY=${{ secrets.SUPABASE_KEY }}"
50+
51+
- name: Debug build output
52+
run: |
53+
echo "Current directory: $(pwd)"
54+
ls -la
55+
if [ -d "build/web" ]; then
56+
echo "build/web exists"
57+
ls -la build/web
58+
else
59+
echo "Error: build/web directory not found"
60+
exit 1
61+
fi
62+
63+
- name: Copy build to temporary directory
64+
run: |
65+
mkdir -p /tmp/web-build
66+
cp -r build/web/* /tmp/web-build/
67+
68+
- name: Debug temporary directory
69+
run: |
70+
echo "Temporary directory contents:"
71+
ls -la /tmp/web-build/
72+
73+
- name: Create or update gh-pages branch
74+
run: |
75+
git config --global user.name 'github-actions[bot]'
76+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
77+
git checkout -B gh-pages
78+
rm -rf ./*
79+
cp -r /tmp/web-build/* .
80+
git add .
81+
git commit -m "Deploy web build to gh-pages" || echo "No changes to commit"
82+
git push origin gh-pages --force
83+
84+
- name: Debug gh-pages branch contents
85+
run: |
86+
echo "gh-pages branch contents after deployment:"
87+
ls -la

0 commit comments

Comments
 (0)