Skip to content

Commit 6c4f326

Browse files
authored
Update release.yml
1 parent 0f7b33b commit 6c4f326

1 file changed

Lines changed: 49 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,57 @@ jobs:
6464
6565
Write-Host "Set AppVersion to $ver and AppVersion_ to $verUnderscore in OpenServerPanel.iss"
6666
67+
- name: Prepare PostgreSQL data dirs (reset ACL and owner)
68+
shell: pwsh
69+
run: |
70+
$ErrorActionPreference = 'Stop'
71+
72+
function Reset-AclRecursive {
73+
param([string]$Path)
74+
if (-not (Test-Path $Path)) { return }
75+
# снять атрибуты
76+
attrib -r -h -s "$Path" /S /D 2>$null
77+
# включить наследование временно, чтобы снять странные ACE
78+
icacls "$Path" /inheritance:e /T /C | Out-Null
79+
# удалить всё и пересоздать
80+
try { Remove-Item "$Path" -Recurse -Force -ErrorAction SilentlyContinue } catch {}
81+
New-Item -ItemType Directory -Force -Path "$Path" | Out-Null
82+
83+
# отключить наследование и установить явные ACE
84+
icacls "$Path" /inheritance:d /T /C | Out-Null
85+
# Права: текущий пользователь, Users, SYSTEM — Full
86+
$me = "$env:USERDOMAIN\$env:USERNAME"
87+
icacls "$Path" /grant:r "$me:(OI)(CI)F" /T /C | Out-Null
88+
icacls "$Path" /grant:r "*S-1-5-18:(OI)(CI)F" /T /C | Out-Null # SYSTEM
89+
icacls "$Path" /grant:r "*S-1-5-32-545:(OI)(CI)F" /T /C | Out-Null # BUILTIN\Users
90+
# Владелец — текущий пользователь
91+
takeown /F "$Path" /R /D Y | Out-Null
92+
cmd /c "icacls ""$Path"" /setowner ""$me"" /T /C" | Out-Null
93+
94+
# ещё раз снять атрибуты на случай системных файлов
95+
attrib -r -h -s "$Path" /S /D 2>$null
96+
}
97+
98+
$modules = Join-Path (Get-Location) 'modules'
99+
$pgVers = 11..17 | ForEach-Object { "PostgreSQL-$_" }
100+
foreach ($v in $pgVers) {
101+
$mod = Join-Path $modules $v
102+
$data = Join-Path $mod 'ospanel_data\default_data'
103+
$tmp = Join-Path $mod 'temp'
104+
Reset-AclRecursive -Path $data
105+
Reset-AclRecursive -Path $tmp
106+
}
107+
108+
Start-Sleep -Seconds 2
109+
67110
- name: Run generators (genall.ps1 and gendb.bat)
68111
shell: pwsh
112+
env:
113+
TMP: D:\a\_temp
114+
TEMP: D:\a\_temp
69115
run: |
116+
$ErrorActionPreference = 'Stop'
117+
if (-not (Test-Path $env:TEMP)) { New-Item -ItemType Directory -Force -Path $env:TEMP | Out-Null }
70118
Set-Location generate
71119
# Выполнить PowerShell-скрипт
72120
.\genall.ps1
@@ -88,4 +136,4 @@ jobs:
88136
uses: actions/upload-artifact@v4
89137
with:
90138
name: open-server-panel-setup
91-
path: release/*.exe
139+
path: release/*.exe

0 commit comments

Comments
 (0)