-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.ps1
More file actions
114 lines (95 loc) · 4.07 KB
/
Copy pathdeploy.ps1
File metadata and controls
114 lines (95 loc) · 4.07 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Load local settings if they exist
if (Test-Path "$PSScriptRoot\local_settings.ps1") {
. "$PSScriptRoot\local_settings.ps1"
}
else {
Write-Warning "local_settings.ps1 not found! Using default/environment values."
}
# Configuration
if (-not $ITCH_USER) { $ITCH_USER = "sihl" }
$ITCH_GAME = "colorpop"
$CHANNEL = "html5"
if (-not $GODOT_PATH) { $GODOT_PATH = "C:\Program Files\godot\godot_console.exe" }
if (-not $BUTLER_PATH) { $BUTLER_PATH = "C:\Program Files\butler\butler.exe" }
# Fix Java Environment for Signing
$env:JAVA_HOME = "C:\Program Files\Eclipse Adoptium\jdk-17.0.17.10-hotspot"
$env:Path = "$env:JAVA_HOME\bin;$env:Path"
Write-Host "Using Godot Path: $GODOT_PATH" -ForegroundColor Gray
Write-Host "Using Butler Path: $BUTLER_PATH" -ForegroundColor Gray
$BUILD_DIR = ".\builds\web"
$PRESET_NAME = "Web"
# 1. Clean previous build
if (Test-Path $BUILD_DIR) {
Remove-Item -Recurse -Force $BUILD_DIR
}
New-Item -ItemType Directory -Force -Path $BUILD_DIR | Out-Null
# 2. Export from Godot
Write-Host "Exporting Project..." -ForegroundColor Cyan
& $GODOT_PATH --headless --export-release $PRESET_NAME "$BUILD_DIR/index.html"
if ($LASTEXITCODE -ne 0) {
Write-Error "Godot export failed!"
exit 1
}
# 3. Push Web Build
Write-Host "Pushing Web Build to itch.io..." -ForegroundColor Cyan
& $BUTLER_PATH push $BUILD_DIR "$ITCH_USER/$ITCH_GAME`:$CHANNEL"
# ---------------------------------------------------------
# ANDROID DEPLOYMENT
# ---------------------------------------------------------
$ANDROID_BUILD_DIR = ".\builds\android"
$ANDROID_PRESET_NAME = "Android"
# 4. Clean Android build
if (Test-Path $ANDROID_BUILD_DIR) {
Remove-Item -Recurse -Force $ANDROID_BUILD_DIR
}
New-Item -ItemType Directory -Force -Path $ANDROID_BUILD_DIR | Out-Null
# 5. Export Android APK
Write-Host "Exporting Android APK (Debug)..." -ForegroundColor Cyan
& $GODOT_PATH --headless --export-debug $ANDROID_PRESET_NAME "$ANDROID_BUILD_DIR/$ITCH_GAME.apk"
if ($LASTEXITCODE -ne 0) {
Write-Error "Godot Android export failed!"
exit 1
}
# 6. Push Android Build
Write-Host "Pushing Android Build to itch.io..." -ForegroundColor Cyan
& $BUTLER_PATH push "$ANDROID_BUILD_DIR/$ITCH_GAME.apk" "$ITCH_USER/$ITCH_GAME`:android"
# ---------------------------------------------------------
# LEGACY DEPLOYMENT ("Match-3 Game")
# ---------------------------------------------------------
# This allows old save files (stored under "Match-3 Game") to keep working
# for specific users on the "match3game" channel.
$LEGACY_PRESET_NAME = "Web"
$LEGACY_BUILD_DIR = ".\builds\web_legacy"
$PROJECT_FILE = ".\project.godot"
# 7. Clean Legacy Output
if (Test-Path $LEGACY_BUILD_DIR) {
Remove-Item -Recurse -Force $LEGACY_BUILD_DIR
}
New-Item -ItemType Directory -Force -Path $LEGACY_BUILD_DIR | Out-Null
# 8. Modify project.godot (Rename "ColorPop" -> "Match-3 Game")
Write-Host "Preparing Legacy Build (Renaming Project)..." -ForegroundColor Yellow
$content = Get-Content $PROJECT_FILE
$content | ForEach-Object { $_ -replace 'config/name="ColorPop"', 'config/name="Match-3 Game"' } | Set-Content $PROJECT_FILE
try {
# 9. Export Legacy Web
Write-Host "Exporting Legacy Web Build..." -ForegroundColor Cyan
& $GODOT_PATH --headless --export-release $LEGACY_PRESET_NAME "$LEGACY_BUILD_DIR/index.html"
if ($LASTEXITCODE -ne 0) {
Write-Warning "Godot Legacy export failed"
}
else {
# 10. Push Legacy Project
# Pushing to a separate itch.io project "match3game" (HTML5 channel)
# instead of a channel on "ColorPop".
$LEGACY_ITCH_GAME = "match3game"
Write-Host "Pushing Legacy Build to project '$LEGACY_ITCH_GAME'..." -ForegroundColor Cyan
& $BUTLER_PATH push $LEGACY_BUILD_DIR "$ITCH_USER/$LEGACY_ITCH_GAME`:$CHANNEL"
}
}
finally {
# 11. Revert project.godot
Write-Host "Reverting Project Name..." -ForegroundColor Yellow
$content = Get-Content $PROJECT_FILE
$content | ForEach-Object { $_ -replace 'config/name="Match-3 Game"', 'config/name="ColorPop"' } | Set-Content $PROJECT_FILE
}
Write-Host "Deployment Complete!" -ForegroundColor Green