-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease_hosting.ps1
More file actions
73 lines (63 loc) · 2.13 KB
/
release_hosting.ps1
File metadata and controls
73 lines (63 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Faunty - Release Hosting Script
# Builds, and deploys the web app to Firebase Hosting (dev or production)
function Show-Selector {
param (
[string[]]$Options
)
$selected = 0
while ($true) {
Clear-Host
Write-Host "Select deployment target:`n"
for ($i = 0; $i -lt $Options.Length; $i++) {
if ($i -eq $selected) {
Write-Host " > $($Options[$i])" -ForegroundColor Cyan
} else {
Write-Host " $($Options[$i])"
}
}
$key = [System.Console]::ReadKey($true)
switch ($key.Key) {
'UpArrow' { if ($selected -gt 0) { $selected-- } }
'DownArrow' { if ($selected -lt ($Options.Length - 1)) { $selected++ } }
'Enter' { return $Options[$selected] }
}
}
}
$envChoice = Show-Selector @('Production', 'Development')
switch ($envChoice) {
'Production' {
$hostingTarget = '2faunty'
$siteName = '2faunty.web.app (Production)'
}
'Development' {
$hostingTarget = 'devfaunty'
$siteName = 'devfaunty.web.app (Development)'
}
default {
Write-Host "`n❌ Invalid choice. Please run the script again." -ForegroundColor Red
exit 1
}
}
Write-Host "🚀 Starting Faunty 2.0 Release..." -ForegroundColor Cyan
# # Step 1: Clean previous build artifacts
# Write-Host "`n🧹 Cleaning build folder..." -ForegroundColor Yellow
# flutter clean
# Step 2: Get dependencies
Write-Host "`n📦 Fetching Flutter packages..." -ForegroundColor Yellow
flutter pub get
# Step 3: Build web app
Write-Host "`n🔨 Building web app..." -ForegroundColor Yellow
flutter build web
if ($LASTEXITCODE -ne 0) {
Write-Host "`n❌ Build failed. Aborting deployment." -ForegroundColor Red
exit 1
}
# Step 4: Deploy to Firebase Hosting
Write-Host "`n🚚 Deploying to Firebase Hosting ($siteName)..." -ForegroundColor Yellow
firebase deploy --only hosting:$hostingTarget
if ($LASTEXITCODE -eq 0) {
Write-Host "`n✅ Deployment successful!" -ForegroundColor Green
} else {
Write-Host "`n❌ Deployment failed." -ForegroundColor Red
exit 1
}