-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (79 loc) · 2.86 KB
/
Copy pathbuild.yml
File metadata and controls
95 lines (79 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build and Release
on:
workflow_dispatch:
push:
tags: ["*"]
permissions:
contents: write
env:
AHK_VERSION: "2.0.23"
AHK2EXE_TAG: "Ahk2Exe1.1.37.02a2"
jobs:
build-release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- name: Install Scoop
shell: pwsh
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh | iex
scoop bucket add extras
exit $LASTEXITCODE
- name: Install AutoHotkey
shell: pwsh
run: |
scoop install extras/autohotkey
- name: Install Ahk2Exe
shell: pwsh
run: |
$url = "https://github.com/AutoHotkey/Ahk2Exe/releases/download/$env:AHK2EXE_TAG/Ahk2Exe.zip"
$compilerDir = "C:\AutoHotkey-Portable\Compiler"
Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\Ahk2Exe.zip"
New-Item -Type Directory -Force $compilerDir | Out-Null
Expand-Archive "$env:TEMP\Ahk2Exe.zip" -DestinationPath $compilerDir -Force
$requiredFiles = @(
"Ahk2Exe.exe"
"Unicode 32-bit.bin"
"Unicode 64-bit.bin"
)
$missingFiles = $requiredFiles | Where-Object {
-not (Test-Path (Join-Path $compilerDir $_))
}
if ($missingFiles) {
throw "Ahk2Exe extraction failed or archive layout changed. Missing expected files in '$compilerDir': $($missingFiles -join ', ')"
}
Remove-Item "$env:TEMP\Ahk2Exe.zip"
- name: Compile Scripts
run: |
$compiler = "C:\AutoHotkey-Portable\Compiler\Ahk2Exe.exe"
$outDir = 'release'
New-Item -Type Directory -Force $outDir | Out-Null
$scripts = Get-ChildItem -Recurse -Filter *.ahk
$compiled = 0
$failed = @()
$scripts | % {
$outExe = Join-Path $outDir "$($_.BaseName).exe"
$rel = $_.FullName -replace [regex]::Escape("$(Get-Location)\"), ''
& $compiler /in $_.FullName /out $outExe 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0 -and (Test-Path $outExe)) {
$compiled++
$size = [math]::Round((Get-Item $outExe).Length / 1KB, 1)
Write-Host "✓ $rel → $($_.BaseName).exe ($size KB)" -ForegroundColor Green
} else {
Write-Host "❌ $rel" -ForegroundColor Red
$failed += $rel
}
}
Write-Host "`nCompiled: $compiled/$($scripts.Count)"
if ($failed) {
Write-Host "`nFailed:" -ForegroundColor Red
$failed | % { Write-Host " $_" }
exit 1
}
shell: pwsh
- name: Create Release
uses: softprops/action-gh-release@v3
with:
files: release/*.exe
fail_on_unmatched_files: true