Skip to content

Commit 34c3fa7

Browse files
committed
Update release.yml
1 parent 20d8001 commit 34c3fa7

1 file changed

Lines changed: 39 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Build Open Server Panel
33
on:
44
workflow_dispatch:
55
inputs:
6-
release_version:
7-
description: 'Release version (e.g. v1.2.3)'
6+
version:
7+
description: 'Version (e.g. 6.4.0)'
88
required: true
99
type: string
1010

@@ -34,13 +34,43 @@ jobs:
3434
Invoke-WebRequest -Uri "https://jrsoftware.org/download.php/is.exe" -OutFile "innosetup.exe"
3535
Start-Process .\innosetup.exe -ArgumentList "/VERYSILENT", "/SUPPRESSMSGBOXES", "/NORESTART" -Wait
3636
37+
- name: Set version in OpenServerPanel.iss
38+
shell: pwsh
39+
run: |
40+
$ver = "${{ inputs.version }}"
41+
if ([string]::IsNullOrWhiteSpace($ver)) {
42+
Write-Error "Version input is empty."
43+
exit 1
44+
}
45+
if ($ver -notmatch '^\d+(\.\d+)*$') {
46+
Write-Error "Version must look like 6.4.0"
47+
exit 1
48+
}
49+
$verUnderscore = $ver -replace '\.', '_'
50+
51+
$issPath = "OpenServerPanel.iss"
52+
if (-not (Test-Path $issPath)) {
53+
Write-Error "OpenServerPanel.iss not found at $issPath"
54+
exit 1
55+
}
56+
57+
$content = Get-Content -Raw -Path $issPath
58+
59+
# Обновляем/вставляем строки с #define в начале файла
60+
$content = $content -replace '(?m)^\#define\s+AppVersion\s+.*$', "#define AppVersion `"$ver`""
61+
$content = $content -replace '(?m)^\#define\s+AppVersion_\s+.*$', "#define AppVersion_ `"$verUnderscore`""
62+
63+
Set-Content -Path $issPath -Value $content -Encoding UTF8
64+
65+
Write-Host "Set AppVersion to $ver and AppVersion_ to $verUnderscore in OpenServerPanel.iss"
66+
3767
- name: Run generators (genall.ps1 and gendb.bat)
3868
shell: pwsh
3969
run: |
4070
Set-Location generate
4171
# Выполнить PowerShell-скрипт
4272
.\genall.ps1
43-
# Выполнить батник (через cmd)
73+
# Выполнить батник (через cmd, чтобы соблюсти кодовую страницу cmd)
4474
cmd /c gendb.bat
4575
Set-Location ..
4676
@@ -53,3 +83,9 @@ jobs:
5383
exit 1
5484
}
5585
& $iscc "OpenServerPanel.iss"
86+
87+
- name: Upload artifact
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: open-server-panel-setup
91+
path: release/*.exe

0 commit comments

Comments
 (0)