Skip to content

Commit 8411e19

Browse files
committed
feat: web and windows deployment
1 parent ea7d4fb commit 8411e19

6 files changed

Lines changed: 84 additions & 46 deletions

File tree

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SUPABASE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRvd3VsdGR1amVsdGJzb2NnaHJ0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Mzk2MjkyNzAsImV4cCI6MjA1NTIwNTI3MH0.tvkdm5klmbB4JvNPfZTcP5Z1AOtwpp1QGGvsnqwM2dk"
2+
SUPABASE_URL = 'https://dowultdujeltbsocghrt.supabase.co'

.github/workflows/build_web.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy Cooketh Flow Web
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Flutter
17+
uses: subosito/flutter-action@v2
18+
with:
19+
flutter-version: '3.29.2'
20+
channel: 'stable'
21+
22+
- name: Install dependencies
23+
run: flutter pub get
24+
25+
- name: Build web
26+
run: flutter build web --release
27+
28+
- name: Create or update web branch
29+
run: |
30+
git config --global user.name 'github-actions[bot]'
31+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
32+
git checkout -B web
33+
rm -rf ./*
34+
cp -r build/web/* .
35+
git add .
36+
git commit -m "Deploy web build" || echo "No changes to commit"
37+
git push origin web --force
Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
# name: Build Windows EXE
1+
name: Build Windows EXE
22

3-
# on: [push, workflow_dispatch]
3+
on: [push, workflow_dispatch]
44

5-
# jobs:
6-
# build-windows:
7-
# runs-on: windows-latest
8-
# steps:
9-
# - name: Checkout code
10-
# uses: actions/checkout@v4
5+
jobs:
6+
build-windows:
7+
runs-on: windows-latest
8+
steps:
9+
- name: Checkout code
10+
uses: actions/checkout@v4
1111

12-
# - name: Setup Flutter
13-
# uses: subosito/flutter-action@v2
14-
# with:
15-
# channel: stable
16-
# cache: true
12+
- name: Setup Flutter
13+
uses: subosito/flutter-action@v2
14+
with:
15+
channel: stable
16+
cache: true
1717

18-
# - name: Install dependencies
19-
# run: flutter pub get
18+
- name: Install dependencies
19+
run: flutter pub get
2020

2121
# - name: Build Windows EXE
2222
# env:
2323
# SUPABASE_URL: ${{ vars.SUPABASE_URL }}
2424
# SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
2525
# run: flutter build windows --release
2626

27-
# - name: Activate Fastforge
28-
# run: dart pub global activate fastforge
27+
- name: Activate Fastforge
28+
run: dart pub global activate fastforge
2929

30-
# - name: Package using Fastforge
31-
# run: fastforge package --platform windows --targets exe
30+
- name: Package using Fastforge
31+
run: fastforge package --platform windows --targets exe
3232

33-
# - name: Upload Artifact
34-
# uses: actions/upload-artifact@v4
35-
# with:
36-
# name: WindowsExecutable
37-
# path: dist/0.1.0/cookethflow-0.1.0-windows-setup.exe
38-
# retention-days: 7
33+
- name: Upload Artifact
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: WindowsExecutable
37+
path: dist/0.1.0/cookethflow-0.1.0-windows-setup.exe
38+
retention-days: 7

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
.history
1111
.svn/
1212
.swiftpm/
13-
.env
1413
migrate_working_dir/
1514

1615
# IntelliJ related
@@ -44,5 +43,4 @@ app.*.map.json
4443
/android/app/debug
4544
/android/app/profile
4645
/android/app/release
47-
/dist/
48-
dotenv
46+
/dist/

dotenv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SUPABASE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRvd3VsdGR1amVsdGJzb2NnaHJ0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Mzk2MjkyNzAsImV4cCI6MjA1NTIwNTI3MH0.tvkdm5klmbB4JvNPfZTcP5Z1AOtwpp1QGGvsnqwM2dk"
2+
SUPABASE_URL = 'https://dowultdujeltbsocghrt.supabase.co'

lib/main.dart

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,23 @@ import 'package:supabase_flutter/supabase_flutter.dart';
1515
Future<void> main() async {
1616
WidgetsFlutterBinding.ensureInitialized();
1717

18-
// Load .env file only in development (when environment variables are not set)
19-
String supabaseUrl;
20-
String supabaseApiKey;
18+
String supabaseUrl = 'https://dowultdujeltbsocghrt.supabase.co';
19+
// below is the public api key.
20+
String supabaseApiKey = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImRvd3VsdGR1amVsdGJzb2NnaHJ0Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3Mzk2MjkyNzAsImV4cCI6MjA1NTIwNTI3MH0.tvkdm5klmbB4JvNPfZTcP5Z1AOtwpp1QGGvsnqwM2dk";
2121

22-
if(kIsWeb){
23-
await dotenv.load(fileName: './dotenv');
24-
supabaseUrl = dotenv.env['SUPABASE_URL'] ?? 'Url';
25-
supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? 'your_api_key';
26-
}
27-
else if(Platform.environment.containsKey('SUPABASE_URL') &&
28-
Platform.environment.containsKey('SUPABASE_KEY')) {
29-
supabaseUrl = Platform.environment['SUPABASE_URL']!;
30-
supabaseApiKey = Platform.environment['SUPABASE_KEY']!;
31-
}else{
32-
await dotenv.load(fileName: '.env');
33-
supabaseUrl = dotenv.env['SUPABASE_URL'] ?? 'Url';
34-
supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? 'your_api_key';
35-
}
22+
// if (kIsWeb) {
23+
// await dotenv.load(fileName: './dotenv');
24+
// supabaseUrl = dotenv.env['SUPABASE_URL'] ?? 'Url';
25+
// supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? 'your_api_key';
26+
// } else if (Platform.environment.containsKey('SUPABASE_URL') &&
27+
// Platform.environment.containsKey('SUPABASE_KEY')) {
28+
// supabaseUrl = Platform.environment['SUPABASE_URL']!;
29+
// supabaseApiKey = Platform.environment['SUPABASE_KEY']!;
30+
// } else {
31+
// await dotenv.load(fileName: '.env');
32+
// supabaseUrl = dotenv.env['SUPABASE_URL'] ?? 'Url';
33+
// supabaseApiKey = dotenv.env['SUPABASE_KEY'] ?? 'your_api_key';
34+
// }
3635

3736
final instance = await Supabase.initialize(
3837
url: supabaseUrl,
@@ -81,4 +80,4 @@ class _MyAppState extends State<MyApp> {
8180
home: SplashScreen(),
8281
);
8382
}
84-
}
83+
}

0 commit comments

Comments
 (0)