@@ -23,13 +23,32 @@ jobs:
2323 git lfs install
2424 git lfs pull
2525
26+ # ВОССТАНОВЛЕНИЕ КЭША ЗАГРУЗОК
27+ - name : Restore downloads cache
28+ uses : actions/cache@v4
29+ with :
30+ path : cache
31+ key : downloads-${{ inputs.version }}-${{ hashFiles('resources/matrix/*.json', 'generate/genall.ps1', 'resources/composer/*') }}
32+ restore-keys : |
33+ downloads-${{ inputs.version }}-
34+ downloads-
35+
36+ # На случай первого запуска — создаём папку кэша
37+ - name : Ensure cache folder exists
38+ shell : pwsh
39+ run : |
40+ if (-not (Test-Path "cache")) { New-Item -ItemType Directory -Path "cache" -Force | Out-Null }
41+ Write-Host "Cache folder ready: $(Resolve-Path cache)"
42+
2643 - name : Remove old Inno Setup (if exists)
44+ shell : pwsh
2745 run : |
2846 if (Test-Path "C:\Program Files (x86)\Inno Setup 6") {
2947 Remove-Item "C:\Program Files (x86)\Inno Setup 6" -Recurse -Force
3048 }
3149
3250 - name : Download and install Inno Setup 6
51+ shell : pwsh
3352 run : |
3453 Invoke-WebRequest -Uri "https://jrsoftware.org/download.php/is.exe" -OutFile "innosetup.exe"
3554 Start-Process .\innosetup.exe -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART" -Wait
@@ -55,15 +74,13 @@ jobs:
5574 }
5675
5776 $content = Get-Content -Raw -Path $issPath
58-
59- # Обновляем/вставляем строки с #define в начале файла
6077 $content = $content -replace '(?m)^\#define\s+AppVersion\s+.*$', "#define AppVersion `"$ver`""
6178 $content = $content -replace '(?m)^\#define\s+AppVersion_\s+.*$', "#define AppVersion_ `"$verUnderscore`""
62-
6379 Set-Content -Path $issPath -Value $content -Encoding UTF8
6480
6581 Write-Host "Set AppVersion to $ver and AppVersion_ to $verUnderscore in OpenServerPanel.iss"
6682
83+ # Подготовка данных PostgreSQL: очистка/ACL для data и temp
6784 - name : Prepare PostgreSQL data dirs (reset ACL and owner)
6885 shell : pwsh
6986 run : |
@@ -73,30 +90,22 @@ jobs:
7390 param([string]$Path)
7491 if (-not (Test-Path $Path)) { return }
7592
76- # снять атрибуты
7793 attrib -r -h -s "$Path" /S /D 2>$null
78-
79- # включить наследование временно
8094 icacls "$Path" /inheritance:e /T /C | Out-Null
8195
82- # удалить и пересоздать
8396 try { Remove-Item "$Path" -Recurse -Force -ErrorAction SilentlyContinue } catch {}
8497 New-Item -ItemType Directory -Force -Path "$Path" | Out-Null
8598
86- # отключить наследование и задать явные ACE
8799 icacls "$Path" /inheritance:d /T /C | Out-Null
88100
89101 $me = "$env:USERDOMAIN\$env:USERNAME"
90- # Владелец: текущий пользователь
91102 takeown /F "$Path" /R /D Y | Out-Null
92103 cmd /c "icacls ""$Path"" /setowner ""$me"" /T /C" | Out-Null
93104
94- # Полные права: текущий пользователь, SYSTEM, BUILTIN\Users
95105 icacls "$Path" /grant:r "${me}:(OI)(CI)F" /T /C | Out-Null
96106 icacls "$Path" /grant:r "*S-1-5-18:(OI)(CI)F" /T /C | Out-Null # SYSTEM
97107 icacls "$Path" /grant:r "*S-1-5-32-545:(OI)(CI)F" /T /C | Out-Null # BUILTIN\Users
98108
99- # ещё раз снять атрибуты
100109 attrib -r -h -s "$Path" /S /D 2>$null
101110 }
102111
@@ -120,10 +129,20 @@ jobs:
120129 run : |
121130 $ErrorActionPreference = 'Stop'
122131 if (-not (Test-Path $env:TEMP)) { New-Item -ItemType Directory -Force -Path $env:TEMP | Out-Null }
132+
133+ # Листинг кэша перед генерацией (для диагностики)
134+ if (Test-Path "..\cache") {
135+ Write-Host "Pre-run cache listing (..\\cache):"
136+ Get-ChildItem -Recurse -Force "..\cache" | Select-Object FullName, Length | Format-Table -AutoSize
137+ } elseif (Test-Path "cache") {
138+ Write-Host "Pre-run cache listing (cache):"
139+ Get-ChildItem -Recurse -Force "cache" | Select-Object FullName, Length | Format-Table -AutoSize
140+ }
141+
123142 Set-Location generate
124- # Выполнить PowerShell-скрипт
143+ # genall.ps1 использует $CacheDir = "..\cache" — это указывает на корневую папку cache
125144 .\genall.ps1
126- # Выполнить батник (через cmd, чтобы соблюсти кодовую страницу cmd)
145+ # gendb.bat — инициализация БД
127146 cmd /c gendb.bat
128147 Set-Location ..
129148
@@ -142,3 +161,23 @@ jobs:
142161 with :
143162 name : open-server-panel-setup
144163 path : release/*.exe
164+
165+ # Диагностика содержимого кэша перед сохранением
166+ - name : List cache dir
167+ if : always()
168+ shell : pwsh
169+ run : |
170+ if (Test-Path "cache") {
171+ Write-Host "Post-run cache listing:"
172+ Get-ChildItem -Recurse -Force "cache" | Select-Object FullName, Length | Format-Table -AutoSize
173+ } else {
174+ Write-Host "Cache directory not found."
175+ }
176+
177+ # СОХРАНЕНИЕ КЭША ПОСЛЕ СБОРКИ
178+ - name : Save downloads cache
179+ if : always()
180+ uses : actions/cache/save@v4
181+ with :
182+ path : cache
183+ key : downloads-${{ inputs.version }}-${{ hashFiles('resources/matrix/*.json', 'generate/genall.ps1', 'resources/composer/*') }}
0 commit comments