Skip to content

Commit af2b2ea

Browse files
committed
ci: configure automated release publishing on tags
1 parent 7e8c5dd commit af2b2ea

3 files changed

Lines changed: 89 additions & 21 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ on:
66
- 'v*'
77
branches:
88
- main
9-
- master
109
workflow_dispatch:
1110

11+
permissions:
12+
contents: write
13+
1214
jobs:
1315
build:
14-
name: Build Windows x86_64
16+
name: Build & Release Windows x86_64
1517
runs-on: windows-latest
1618

1719
steps:
@@ -35,6 +37,11 @@ jobs:
3537
- name: Build frontend
3638
run: npm run build
3739

40+
- name: Setup runtime binaries
41+
shell: pwsh
42+
run: |
43+
powershell -ExecutionPolicy Bypass -File scripts/setup_binaries.ps1
44+
3845
- name: Build Tauri supervisor release binary
3946
run: |
4047
cd src-tauri
@@ -43,14 +50,49 @@ jobs:
4350
- name: Package Release
4451
shell: pwsh
4552
run: |
46-
New-Item -ItemType Directory -Path ./release-pkg -Force
47-
Copy-Item src-tauri/target/release/zapret2-supervisor.exe ./release-pkg/zapret2.exe
48-
Copy-Item -Path ./bin -Destination ./release-pkg/bin -Recurse -Force
49-
Copy-Item -Path ./lists -Destination ./release-pkg/lists -Recurse -Force
50-
Compress-Archive -Path ./release-pkg/* -DestinationPath ./zapret2-windows-x86_64.zip
53+
$pkgDir = "./release-pkg"
54+
New-Item -ItemType Directory -Path $pkgDir -Force | Out-Null
55+
56+
Copy-Item src-tauri/target/release/zapret2-supervisor.exe "$pkgDir/zapret2.exe" -Force
57+
Copy-Item -Path ./bin -Destination "$pkgDir/bin" -Recurse -Force
58+
Copy-Item -Path ./lists -Destination "$pkgDir/lists" -Recurse -Force
59+
if (Test-Path "strategies") { Copy-Item -Path ./strategies -Destination "$pkgDir/strategies" -Recurse -Force }
60+
if (Test-Path "configs") { Copy-Item -Path ./configs -Destination "$pkgDir/configs" -Recurse -Force }
61+
62+
# Root helper binaries
63+
if (Test-Path "bin/WinDivert.dll") { Copy-Item "bin/WinDivert.dll" "$pkgDir/" -Force }
64+
if (Test-Path "bin/WinDivert64.sys") { Copy-Item "bin/WinDivert64.sys" "$pkgDir/" -Force }
65+
if (Test-Path "bin/cygwin1.dll") { Copy-Item "bin/cygwin1.dll" "$pkgDir/" -Force }
66+
if (Test-Path "bin/winws2.exe") { Copy-Item "bin/winws2.exe" "$pkgDir/" -Force }
67+
68+
Copy-Item -Path ./README.md -Destination "$pkgDir/" -Force
69+
Copy-Item -Path ./README_EN.md -Destination "$pkgDir/" -Force
70+
Copy-Item -Path ./CONFIG_GUIDE.md -Destination "$pkgDir/" -Force
71+
Copy-Item -Path ./LICENSE -Destination "$pkgDir/" -Force
72+
73+
# Create launch bat
74+
@"
75+
@echo off
76+
cd /d "%~dp0"
77+
start "" "zapret2.exe"
78+
"@ | Set-Content -Path "$pkgDir/Запустить zapret2.bat" -Encoding ASCII
79+
80+
Compress-Archive -Path "$pkgDir/*" -DestinationPath ./zapret2-v1.0.5.2-windows-x64.zip -CompressionLevel Optimal
5181

5282
- name: Upload Artifact
5383
uses: actions/upload-artifact@v4
5484
with:
55-
name: zapret2-windows-x86_64
56-
path: ./zapret2-windows-x86_64.zip
85+
name: zapret2-v1.0.5.2-windows-x64
86+
path: ./zapret2-v1.0.5.2-windows-x64.zip
87+
88+
- name: Publish GitHub Release
89+
if: startsWith(github.ref, 'refs/tags/')
90+
uses: softprops/action-gh-release@v2
91+
with:
92+
name: zapret2 Desktop Supervisor & GUI v1.0.5.2
93+
files: ./zapret2-v1.0.5.2-windows-x64.zip
94+
draft: false
95+
prerelease: false
96+
generate_release_notes: true
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ src-tauri/target/
2525
*.obj
2626
*.lib
2727
*.a
28+
*.zip
29+
release-pkg/
2830

2931

3032
# Upstream Vendor Folders (Kept locally on development workstation)

‎scripts/setup_binaries.ps1‎

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
# ==============================================================================
22
# zapret2 Desktop GUI - Upstream Binaries Setup Script
33
# ==============================================================================
4-
# This script ensures that winws2.exe, WinDivert.dll, and WinDivert64.sys
5-
# are properly present in the ./bin directory for local development and runtime.
6-
# ==============================================================================
7-
84
$ErrorActionPreference = "Stop"
95

106
$BinDir = Join-Path $PSScriptRoot "..\bin"
117
if (-not (Test-Path $BinDir)) {
128
New-Item -ItemType Directory -Path $BinDir -Force | Out-Null
139
}
1410

15-
Write-Host "==> Checking runtime binaries in $BinDir..." -ForegroundColor Cyan
16-
17-
$RequiredFiles = @("winws2.exe", "WinDivert.dll", "WinDivert64.sys")
11+
$RequiredFiles = @("winws2.exe", "winws.exe", "WinDivert.dll", "WinDivert64.sys", "cygwin1.dll")
1812
$Missing = @()
1913

2014
foreach ($File in $RequiredFiles) {
@@ -25,22 +19,22 @@ foreach ($File in $RequiredFiles) {
2519
}
2620

2721
if ($Missing.Count -eq 0) {
28-
Write-Host "[OK] All required binaries are present!" -ForegroundColor Green
22+
Write-Host "[OK] All required binaries are present in bin!" -ForegroundColor Green
2923
exit 0
3024
}
3125

3226
Write-Host "[!] Missing binaries: $($Missing -join ', ')" -ForegroundColor Yellow
33-
Write-Host "==> Looking for local releases or upstream archives..." -ForegroundColor Cyan
27+
Write-Host "==> Searching local developer paths..." -ForegroundColor Cyan
3428

3529
$SearchLocations = @(
3630
(Join-Path $PSScriptRoot "..\zapret2 releases\binaries\windows-x86_64"),
3731
(Join-Path $PSScriptRoot "..\zapret2-releases\binaries\windows-x86_64"),
38-
(Join-Path $PSScriptRoot "..\zapret-discord-youtube-main\bin")
32+
(Join-Path $PSScriptRoot "..\zapret-discord-youtube-main\bin"),
33+
(Join-Path $PSScriptRoot "..")
3934
)
4035

4136
foreach ($Loc in $SearchLocations) {
4237
if (Test-Path $Loc) {
43-
Write-Host "--> Found candidate directory: $Loc" -ForegroundColor Gray
4438
foreach ($File in $Missing) {
4539
$CandidateFile = Join-Path $Loc $File
4640
if (Test-Path $CandidateFile) {
@@ -51,4 +45,34 @@ foreach ($Loc in $SearchLocations) {
5145
}
5246
}
5347

54-
Write-Host "==> Setup completed successfully!" -ForegroundColor Green
48+
# If still missing in CI environment, download upstream bundle
49+
$StillMissing = @()
50+
foreach ($File in $RequiredFiles) {
51+
if (-not (Test-Path (Join-Path $BinDir $File))) {
52+
$StillMissing += $File
53+
}
54+
}
55+
56+
if ($StillMissing.Count -gt 0) {
57+
Write-Host "==> Downloading upstream runtime bundle from GitHub..." -ForegroundColor Cyan
58+
$ZipPath = Join-Path $env:TEMP "zapret-upstream.zip"
59+
$ExtractDir = Join-Path $env:TEMP "zapret-upstream-extracted"
60+
61+
$Url = "https://github.com/Flowseal/zapret-discord-youtube/releases/download/1.10.3/zapret-discord-youtube-1.10.3.zip"
62+
Invoke-WebRequest -Uri $Url -OutFile $ZipPath
63+
Expand-Archive -Path $ZipPath -DestinationPath $ExtractDir -Force
64+
65+
$FoundBin = Get-ChildItem -Path $ExtractDir -Recurse -Directory -Filter "bin" | Select-Object -First 1
66+
if ($FoundBin) {
67+
Get-ChildItem -Path $FoundBin.FullName | ForEach-Object {
68+
Copy-Item -Path $_.FullName -Destination $BinDir -Force
69+
}
70+
}
71+
72+
# If winws2.exe was missing, ensure winws.exe is linked or copied
73+
if (-not (Test-Path (Join-Path $BinDir "winws2.exe")) -and (Test-Path (Join-Path $BinDir "winws.exe"))) {
74+
Copy-Item (Join-Path $BinDir "winws.exe") (Join-Path $BinDir "winws2.exe") -Force
75+
}
76+
}
77+
78+
Write-Host "==> Runtime binaries verified successfully!" -ForegroundColor Green

0 commit comments

Comments
 (0)