Compile AutoIt Script #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Compile AutoIt Script | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| paths: [ 'ZoomMate.au3' ] | |
| pull_request: | |
| branches: [ main, master ] | |
| paths: [ 'ZoomMate.au3' ] | |
| workflow_dispatch: | |
| jobs: | |
| compile: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # - name: Install Chocolatey | |
| # run: | | |
| # Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
| - name: Install AutoIt via Chocolatey | |
| run: | | |
| choco install autoit --yes | |
| - name: Compile AutoIt script | |
| run: | | |
| $autoItPath = "${env:ProgramFiles(x86)}\AutoIt3\Aut2exe\Aut2exe.exe" | |
| $iconPath = "zoommate.ico" | |
| $buildDir = "build" | |
| # Create build directory if it doesn't exist | |
| if (!(Test-Path $buildDir)) { | |
| New-Item -ItemType Directory -Path $buildDir | |
| } | |
| # Find all translation files and build file parameters | |
| $fileParams = "" | |
| if (Test-Path "i18n") { | |
| $iniFiles = Get-ChildItem -Path "i18n" -Name "*.ini" -Recurse | |
| foreach ($file in $iniFiles) { | |
| $fileParams += " /file \"i18n\$file\"" | |
| } | |
| } | |
| # Check if icon file exists | |
| if (Test-Path $iconPath) { | |
| Write-Host "Using icon: $iconPath" | |
| $compileCmd = "$autoItPath /in \"ZoomMate.au3\" /out \"$buildDir\ZoomMate.exe\" /icon $iconPath$fileParams" | |
| } else { | |
| Write-Host "Icon file not found, compiling without icon" | |
| $compileCmd = "$autoItPath /in \"ZoomMate.au3\" /out \"$buildDir\ZoomMate.exe\"$fileParams" | |
| } | |
| Write-Host "Compilation command: $compileCmd" | |
| Invoke-Expression $compileCmd | |
| - name: Verify compilation | |
| run: | | |
| if (Test-Path "build/ZoomMate.exe") { | |
| $fileSize = (Get-Item "build/ZoomMate.exe").Length | |
| Write-Host "Compilation successful! File size: $fileSize bytes" | |
| } else { | |
| Write-Host "Compilation failed - executable not found" | |
| exit 1 | |
| } | |
| - name: Commit compiled executable | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git add build/ZoomMate.exe | |
| git diff --quiet && git diff --staged --quiet || git commit -m "Update compiled executable [skip ci]" | |
| git push -f |