Skip to content

Compile AutoHotkey Scripts #13

Compile AutoHotkey Scripts

Compile AutoHotkey Scripts #13

Workflow file for this run

name: Compile AutoHotkey Scripts
on:
workflow_dispatch:
jobs:
create_release:
permissions:
contents: write
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Compile all .ahk scripts in the root
shell: pwsh
run: |
$compiler = ".\compiler\Ahk2Exe.exe"
$base = Resolve-Path ".\compiler\AutoHotkeySC.bin"
if (!(Test-Path $compiler)) {
Write-Error "Ahk2Exe.exe not found at $compiler"
exit 1
} else {
Write-Host "Found Ahk2Exe.exe at $compiler"
}
New-Item -ItemType Directory -Path .\dist -Force | Out-Null
$outputDir = Resolve-Path -Path ".\dist"
Get-ChildItem -Path . -Filter *.ahk | ForEach-Object {
$input = $_.FullName
$output = Join-Path -Path $outputDir -ChildPath "$($_.BaseName).exe"
Write-Host "Compiling $input -> $output"
& "$compiler" /in "$input" /out "$output" /base "$base"
# Wait for the output to appear
$maxWait = 30
$attempt = 0
while (-not (Test-Path $output) -and $attempt -lt $maxWait) {
Start-Sleep -Milliseconds 100
$attempt++
}
if (!(Test-Path $output)) {
Write-Error "ERROR: Compilation failed — output not created: $output"
exit 1
} else {
Write-Host "✅ Compiled successfully: $output"
}
}
Write-Host "Compiled files:"
Get-ChildItem -Path $outputDir.Path
- name: Create github release
# You may pin to the exact commit or the version.
# uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87
uses: softprops/action-gh-release@v2.0.5
with:
tag_name: v1.0.0-${{ github.run_number }}
files: |
dist/*.exe
name: "AutoHotkey Scripts Build ${{ github.run_number }}"
body: "This release contains compiled scripts built automatically from the workflow."