ci: fix broken windows tool
Queue Release Build / prepare (push) Successful in 1m54s
Queue Release Build / build-windows (push) Successful in 30m48s
Queue Release Build / build-linux (push) Successful in 44m39s
Queue Release Build / build-android (push) Successful in 20m7s
Queue Release Build / finalize (push) Successful in 1m0s
Deploy Web Apps / deploy (push) Successful in 6m28s
Queue Release Build / prepare (push) Successful in 1m54s
Queue Release Build / build-windows (push) Successful in 30m48s
Queue Release Build / build-linux (push) Successful in 44m39s
Queue Release Build / build-android (push) Successful in 20m7s
Queue Release Build / finalize (push) Successful in 1m0s
Deploy Web Apps / deploy (push) Successful in 6m28s
This commit is contained in:
@@ -249,8 +249,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
$projectRoot = $PWD.ProviderPath
|
$projectRoot = $PWD.ProviderPath
|
||||||
$electronBuilderWorkspace = Join-Path $env:TEMP ([guid]::NewGuid().ToString('N'))
|
$electronBuilderWorkspace = Join-Path $env:TEMP ([guid]::NewGuid().ToString('N'))
|
||||||
$electronBuilderCache = Join-Path $electronBuilderWorkspace 'electron-builder-cache'
|
$electronBuilderCache = Join-Path $env:LOCALAPPDATA 'electron-builder\Cache'
|
||||||
$electronCache = Join-Path $electronBuilderWorkspace 'electron-cache'
|
$electronCache = Join-Path $env:LOCALAPPDATA 'electron\Cache'
|
||||||
$locationPushed = $false
|
$locationPushed = $false
|
||||||
|
|
||||||
function Invoke-RoboCopy {
|
function Invoke-RoboCopy {
|
||||||
@@ -266,21 +266,68 @@ jobs:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Initialize-WinCodeSignCache {
|
||||||
|
param(
|
||||||
|
[string]$CacheRoot,
|
||||||
|
[string]$SevenZip
|
||||||
|
)
|
||||||
|
|
||||||
|
# electron-builder downloads winCodeSign for rcedit (icon and version stamping)
|
||||||
|
# even when nothing is signed. Its two darwin symlinks cannot be recreated
|
||||||
|
# without SeCreateSymbolicLinkPrivilege, so seed the cache without them.
|
||||||
|
# The version must match the one app-builder resolves, otherwise it downloads
|
||||||
|
# its own copy and fails on the symlinks again.
|
||||||
|
$version = 'winCodeSign-2.6.0'
|
||||||
|
$target = Join-Path $CacheRoot "winCodeSign\$version"
|
||||||
|
|
||||||
|
if (Test-Path $target) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
$staging = "$target.incomplete"
|
||||||
|
$archive = Join-Path $env:TEMP "$version.7z"
|
||||||
|
$url = "https://github.com/electron-userland/electron-builder-binaries/releases/download/$version/$version.7z"
|
||||||
|
|
||||||
|
Remove-Item $staging -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
try {
|
||||||
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
Invoke-WebRequest -Uri $url -OutFile $archive -UseBasicParsing
|
||||||
|
& $SevenZip x -bd -y "-o$staging" '-x!darwin' $archive | Out-Null
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
throw "failed to extract $version with exit code $LASTEXITCODE"
|
||||||
|
}
|
||||||
|
|
||||||
|
New-Item -ItemType Directory -Path (Split-Path -Parent $target) -Force | Out-Null
|
||||||
|
Move-Item $staging $target
|
||||||
|
} finally {
|
||||||
|
Remove-Item $archive -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item $staging -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Stage the packaging inputs into a real short-path directory.
|
# Stage the packaging inputs into a real short-path directory.
|
||||||
# electron-builder rejects junction-backed files during asar creation
|
# electron-builder rejects junction-backed files during asar creation
|
||||||
# because their resolved path sits outside the package root.
|
# because their resolved path sits outside the package root.
|
||||||
New-Item -ItemType Directory -Path $electronBuilderWorkspace | Out-Null
|
New-Item -ItemType Directory -Path $electronBuilderWorkspace | Out-Null
|
||||||
New-Item -ItemType Directory -Path $electronBuilderCache | Out-Null
|
New-Item -ItemType Directory -Path $electronBuilderCache -Force | Out-Null
|
||||||
New-Item -ItemType Directory -Path $electronCache | Out-Null
|
New-Item -ItemType Directory -Path $electronCache -Force | Out-Null
|
||||||
$env:ELECTRON_BUILDER_CACHE = $electronBuilderCache
|
$env:ELECTRON_BUILDER_CACHE = $electronBuilderCache
|
||||||
$env:ELECTRON_CACHE = $electronCache
|
$env:ELECTRON_CACHE = $electronCache
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Initialize-WinCodeSignCache `
|
||||||
|
-CacheRoot $electronBuilderCache `
|
||||||
|
-SevenZip (Join-Path $projectRoot 'node_modules\7zip-bin\win\x64\7za.exe')
|
||||||
|
|
||||||
Copy-Item -Path (Join-Path $projectRoot 'package.json') -Destination (Join-Path $electronBuilderWorkspace 'package.json') -Force
|
Copy-Item -Path (Join-Path $projectRoot 'package.json') -Destination (Join-Path $electronBuilderWorkspace 'package.json') -Force
|
||||||
Copy-Item -Path (Join-Path $projectRoot 'package-lock.json') -Destination (Join-Path $electronBuilderWorkspace 'package-lock.json') -Force
|
Copy-Item -Path (Join-Path $projectRoot 'package-lock.json') -Destination (Join-Path $electronBuilderWorkspace 'package-lock.json') -Force
|
||||||
Invoke-RoboCopy (Join-Path $projectRoot 'dist') (Join-Path $electronBuilderWorkspace 'dist')
|
Invoke-RoboCopy (Join-Path $projectRoot 'dist') (Join-Path $electronBuilderWorkspace 'dist')
|
||||||
Invoke-RoboCopy (Join-Path $projectRoot 'docs-site/build') (Join-Path $electronBuilderWorkspace 'docs-site/build')
|
Invoke-RoboCopy (Join-Path $projectRoot 'docs-site/build') (Join-Path $electronBuilderWorkspace 'docs-site/build')
|
||||||
Invoke-RoboCopy (Join-Path $projectRoot 'images') (Join-Path $electronBuilderWorkspace 'images')
|
Invoke-RoboCopy (Join-Path $projectRoot 'images') (Join-Path $electronBuilderWorkspace 'images')
|
||||||
|
Invoke-RoboCopy (Join-Path $projectRoot 'tools') (Join-Path $electronBuilderWorkspace 'tools')
|
||||||
Invoke-RoboCopy (Join-Path $projectRoot 'node_modules') (Join-Path $electronBuilderWorkspace 'node_modules')
|
Invoke-RoboCopy (Join-Path $projectRoot 'node_modules') (Join-Path $electronBuilderWorkspace 'node_modules')
|
||||||
|
|
||||||
Push-Location $electronBuilderWorkspace
|
Push-Location $electronBuilderWorkspace
|
||||||
|
|||||||
@@ -9,6 +9,16 @@ param(
|
|||||||
Set-StrictMode -Version Latest
|
Set-StrictMode -Version Latest
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
# Reading IIS configuration (redirection.config) and creating sites needs a full
|
||||||
|
# administrator token. An interactive logon gets a UAC-filtered one, which fails
|
||||||
|
# later with a confusing "cannot retrieve the dynamic parameters" error.
|
||||||
|
$currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
|
||||||
|
$currentPrincipal = [Security.Principal.WindowsPrincipal]::new($currentIdentity)
|
||||||
|
|
||||||
|
if (-not $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||||
|
throw "IIS deployment requires an elevated administrator token, but '$($currentIdentity.Name)' does not have one. Add the runner account to the local Administrators group and run the Gitea runner as a Windows service."
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Import-Module WebAdministration -ErrorAction Stop
|
Import-Module WebAdministration -ErrorAction Stop
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user