Fix Windows release CI parsing and publish Forgejo via git.avelo.top.

Use pwsh -File with UTF-8 BOM scripts, and default Forgejo uploads to the public domain when LAN IP is unreachable.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-10-08 21:06:47 +08:00
parent a9c9d17550
commit 7e78485396
7 changed files with 24 additions and 24 deletions

View file

@ -25,7 +25,8 @@ jobs:
- name: Build release stage - name: Build release stage
shell: pwsh shell: pwsh
run: | run: |
powershell -ExecutionPolicy Bypass -File ./packaging/build_release.ps1 -CreateVenv # Use pwsh -File (UTF-8). Nested Windows PowerShell 5.1 mis-parses UTF-8 scripts without BOM.
& ./packaging/build_release.ps1 -CreateVenv
- name: Install Inno Setup - name: Install Inno Setup
shell: pwsh shell: pwsh

View file

@ -122,7 +122,7 @@ Do this on the **dev PC on the home LAN** after bumping version:
1. **Build** — `.\packaging\build_release.ps1 -CreateVenv` + Inno Setup → `NetX-Setup-*.exe` 1. **Build** — `.\packaging\build_release.ps1 -CreateVenv` + Inno Setup → `NetX-Setup-*.exe`
2. **GitHub** — `.\packaging\publish_release.ps1 -Version x.y.z` (uploads Setup.exe only) 2. **GitHub** — `.\packaging\publish_release.ps1 -Version x.y.z` (uploads Setup.exe only)
3. **Forgejo (intranet)** — upload the same Setup.exe to QNAP Forgejo; public `git.avelo.top` is only a reverse proxy to the same instance: 3. **Forgejo** — upload the same Setup.exe (default: public domain `https://git.avelo.top`):
```powershell ```powershell
# One-time: User env var (never commit the token) # One-time: User env var (never commit the token)
@ -130,23 +130,22 @@ Do this on the **dev PC on the home LAN** after bumping version:
[Environment]::SetEnvironmentVariable("NETX_FORGEJO_TOKEN", "your_token", "User") [Environment]::SetEnvironmentVariable("NETX_FORGEJO_TOKEN", "your_token", "User")
# Restart Cursor / open a new terminal so the agent/scripts see it # Restart Cursor / open a new terminal so the agent/scripts see it
# Default publishes to LAN Forgejo; public git.avelo.top shows the same Release. # Default: https://git.avelo.top
.\packaging\publish_forgejo_release.ps1 -Version 0.4.0 .\packaging\publish_forgejo_release.ps1 -Version 0.4.11
# Only when off the home LAN: # Optional when LAN IP is reachable:
# .\packaging\publish_forgejo_release.ps1 -Version 0.4.0 -ForgejoBase "https://git.avelo.top" # .\packaging\publish_forgejo_release.ps1 -Version 0.4.11 -ForgejoBase "http://10.0.0.131:3000"
``` ```
| Role | URL | | Role | URL |
|------|-----| |------|-----|
| Publish default (home LAN) | `http://10.0.0.131:3000` (`-ForgejoBase` default) | | Publish default | `https://git.avelo.top` (`-ForgejoBase` default) |
| Clients / remote clone | `https://git.avelo.top` (Caddy → `10.0.0.131:3000`) | | Optional LAN | `http://10.0.0.131:3000` |
| Update probe (default) | GitHub + `https://git.avelo.top/.../releases/latest` | | Update probe (default) | GitHub + `https://git.avelo.top/.../releases/latest` |
Verify: Verify:
- LAN: http://10.0.0.131:3000/hansjone/netx/releases - https://git.avelo.top/hansjone/netx/releases
- Public: https://git.avelo.top/hansjone/netx/releases
- Probe: `.\packaging\check_update.ps1` → both `github` and `forgejo` reachable with the new version - Probe: `.\packaging\check_update.ps1` → both `github` and `forgejo` reachable with the new version
Token: `NETX_FORGEJO_TOKEN` (or `FORGEJO_TOKEN`). Token: `NETX_FORGEJO_TOKEN` (or `FORGEJO_TOKEN`).

View file

@ -1,4 +1,4 @@
param( param(
[string]$Version = "", [string]$Version = "",
[string]$OutDir = "", [string]$OutDir = "",
[switch]$SkipWebBuild = $false, [switch]$SkipWebBuild = $false,
@ -128,13 +128,13 @@ if (Test-Path $winswShip) {
Copy-Item -Path $winswShip -Destination (Join-Path $winswOut "WinSW-x64.exe") -Force Copy-Item -Path $winswShip -Destination (Join-Path $winswOut "WinSW-x64.exe") -Force
Write-Host "==> Bundled WinSW for offline service install" Write-Host "==> Bundled WinSW for offline service install"
} else { } else {
Write-Host "[WARN] WinSW missing — offline service install will fail" -ForegroundColor Yellow Write-Host "[WARN] WinSW missing - offline service install will fail" -ForegroundColor Yellow
} }
New-Item -ItemType Directory -Path (Join-Path $packOut "postgres") -Force | Out-Null New-Item -ItemType Directory -Path (Join-Path $packOut "postgres") -Force | Out-Null
Copy-Item -Path (Join-Path $PSScriptRoot "postgres\README.md") -Destination (Join-Path $packOut "postgres\README.md") -Force Copy-Item -Path (Join-Path $PSScriptRoot "postgres\README.md") -Destination (Join-Path $packOut "postgres\README.md") -Force
if (Test-Path (Join-Path $pgsql "bin\pg_ctl.exe")) { if (Test-Path (Join-Path $pgsql "bin\pg_ctl.exe")) {
Write-Host "==> Copying bundled PostgreSQL (bin/lib/share; skip doc/)" Write-Host '==> Copying bundled PostgreSQL (bin/lib/share; skip doc/)'
$pgStage = Join-Path $stage "postgres\pgsql" $pgStage = Join-Path $stage "postgres\pgsql"
New-Item -ItemType Directory -Path $pgStage -Force | Out-Null New-Item -ItemType Directory -Path $pgStage -Force | Out-Null
foreach ($sub in @("bin", "lib", "share")) { foreach ($sub in @("bin", "lib", "share")) {
@ -196,7 +196,7 @@ if ($CreateVenv) {
$venvDir = Join-Path $stage ".venv" $venvDir = Join-Path $stage ".venv"
if (Test-Path $venvDir) { Remove-Item -Recurse -Force $venvDir } if (Test-Path $venvDir) { Remove-Item -Recurse -Force $venvDir }
Write-Host "==> Creating .venv from shipped runtime (--copies)" Write-Host '==> Creating .venv from shipped runtime (--copies)'
& $rtPy -m venv $venvDir --copies & $rtPy -m venv $venvDir --copies
if ($LASTEXITCODE -ne 0) { throw "venv_create_failed" } if ($LASTEXITCODE -ne 0) { throw "venv_create_failed" }

View file

@ -1,4 +1,4 @@
param( param(
[string]$ProgramRoot = "", [string]$ProgramRoot = "",
[string]$DataRoot = "", [string]$DataRoot = "",
[string]$UpdateUrl = "", [string]$UpdateUrl = "",

View file

@ -1,6 +1,6 @@
param( param(
[string]$Version = "", [string]$Version = "",
[string]$ForgejoBase = "http://10.0.0.131:3000", [string]$ForgejoBase = "https://git.avelo.top",
[string]$Owner = "hansjone", [string]$Owner = "hansjone",
[string]$Repo = "netx", [string]$Repo = "netx",
[string]$Token = "", [string]$Token = "",
@ -9,14 +9,14 @@ param(
# Publish Windows Setup.exe to Forgejo/Gitea (mirror sync does NOT copy GitHub Release files). # Publish Windows Setup.exe to Forgejo/Gitea (mirror sync does NOT copy GitHub Release files).
# Requires a Forgejo token with repo write (Settings → Applications → Generate New Token). # Requires a Forgejo token with repo write (Settings → Applications → Generate New Token).
# Default: home LAN Forgejo. Public git.avelo.top is the same instance (VPS reverse proxy). # Default: https://git.avelo.top (public domain). LAN IP only when explicitly reachable.
# #
# Example (usual — LAN): # Example:
# $env:NETX_FORGEJO_TOKEN = "..." # or User env NETX_FORGEJO_TOKEN # $env:NETX_FORGEJO_TOKEN = "..." # or User env NETX_FORGEJO_TOKEN
# .\packaging\publish_forgejo_release.ps1 -Version 0.4.0 # .\packaging\publish_forgejo_release.ps1 -Version 0.4.11
# #
# Away from LAN only (hairpins via VPS): # Optional LAN (when 10.0.0.131 is reachable):
# .\packaging\publish_forgejo_release.ps1 -Version 0.4.0 -ForgejoBase "https://git.avelo.top" # .\packaging\publish_forgejo_release.ps1 -Version 0.4.11 -ForgejoBase "http://10.0.0.131:3000"
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
. "$PSScriptRoot\_common.ps1" . "$PSScriptRoot\_common.ps1"

View file

@ -1,4 +1,4 @@
param( param(
[string]$Version = "", [string]$Version = "",
[switch]$SkipBuild = $false, [switch]$SkipBuild = $false,
[switch]$SkipInstaller = $false, [switch]$SkipInstaller = $false,

View file

@ -1,4 +1,4 @@
param( param(
[Parameter(Mandatory = $true)] [Parameter(Mandatory = $true)]
[string]$PackagePath, [string]$PackagePath,
[string]$ProgramRoot = "", [string]$ProgramRoot = "",