Skip to content

Commit 5d284a9

Browse files
author
Soham Dasgupta
committed
feat: Ahk2Exe directives and ci build script
1 parent b7cc6dd commit 5d284a9

File tree

3 files changed

+30
-54
lines changed

3 files changed

+30
-54
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -17,55 +17,10 @@ jobs:
1717
if: startsWith(github.ref, 'refs/tags/v')
1818
with:
1919
fetch-depth: 0
20-
- name: Compile AHK script
21-
uses: nukdokplex/[email protected]
22-
if: startsWith(github.ref, 'refs/tags/v')
23-
with:
24-
version: v2.0.10
25-
x64: true
26-
x86: true
27-
compression: upx
28-
in: .\
29-
x64_suffix: "-x64"
30-
x86_suffix: "-x86"
31-
icon: logo.ico
32-
- name: Generate checksums
33-
shell: pwsh
34-
if: startsWith(github.ref, 'refs/tags/v')
35-
run: |
36-
$cwd = (Get-Location).Path;
37-
$checksumFile = "$cwd\build\polygon-checksum.txt";
38-
$hash_x86 = Get-FileHash -Path "$cwd\build\polygon-x86.exe" -Algorithm SHA256;
39-
$hash_x64 = Get-FileHash -Path "$cwd\build\polygon-x64.exe" -Algorithm SHA256;
40-
"polygon-x86.exe: $($hash_x86.Hash)".ToLower() | Out-File -Append -FilePath $checksumFile;
41-
"polygon-x64.exe: $($hash_x64.Hash)".ToLower() | Out-File -Append -FilePath $checksumFile;
42-
- name: Zip Polygon x64
43-
shell: pwsh
44-
if: startsWith(github.ref, 'refs/tags/v')
45-
run: |
46-
$cwd = (Get-Location).Path;
47-
Compress-Archive -Path "$cwd\polygon.ini","$cwd\build\polygon-x64.exe" -DestinationPath "$cwd\build\polygon-x64.zip";
48-
- name: Zip Polygon x86
49-
shell: pwsh
50-
if: startsWith(github.ref, 'refs/tags/v')
51-
run: |
52-
$cwd = (Get-Location).Path;
53-
Compress-Archive -Path "$cwd\polygon.ini","$cwd\build\polygon-x86.exe" -DestinationPath "$cwd\build\polygon-x86.zip";
54-
- name: Build MSI
20+
- name: Build Polygon
5521
shell: pwsh
5622
if: startsWith(github.ref, 'refs/tags/v')
57-
run: |
58-
$cwd = (Get-Location).Path;
59-
$versionNumber = (Select-String -Pattern "\d+\.\d+\.\d+" -InputObject $env:GITHUB_REF).Matches[0].Value
60-
$wixFolder = "C:\Program Files (x86)\WiX Toolset v3.11\bin";
61-
$candleToolPath = Join-Path $wixFolder -ChildPath "candle.exe";
62-
$lightToolPath = Join-Path $wixFolder -ChildPath "light.exe";
63-
64-
& "$candleToolPath" "$cwd\polygon.wxs" -out "$cwd\build\polygon-x86.wixobj" -dVersion="$versionNumber" -arch x86;
65-
& "$candleToolPath" "$cwd\polygon.wxs" -out "$cwd\build\polygon-x64.wixobj" -dVersion="$versionNumber" -arch x64;
66-
67-
& "$lightToolPath" "$cwd\build\polygon-x86.wixobj" -ext WixUIExtension -out "$cwd\build\polygon-x86.msi";
68-
& "$lightToolPath" "$cwd\build\polygon-x64.wixobj" -ext WixUIExtension -out "$cwd\build\polygon-x64.msi";
23+
run: $GITHUB_WORKSPACE/polygon.ps1;
6924
- name: Upload to GitHub release
7025
uses: softprops/action-gh-release@v1
7126
if: startsWith(github.ref, 'refs/tags/v')

polygon.ahk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
#DllLoad Dwmapi.dll
44
#DllLoad User32.dll
55

6+
;-- Ahk2Exe properties
7+
;@Ahk2Exe-SetName Polygon
8+
;@Ahk2Exe-SetVersion 0.2.0
9+
;@Ahk2Exe-SetCompanyName Soham Dasgupta
10+
;@Ahk2Exe-SetDescription A window manager for Windows 10/11 powered by AutoHotkey
11+
612
;-- Globals
713
global APP_VERSION := "0.2.0"
814
global APP_VERSION_NAME := "v" . APP_VERSION

polygon.ps1

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Write-Host "Building Polygon version $versionNumber" -ForegroundColor Green;
99

1010
# Clean build folder
1111
Remove-Item -Path "$cwd\build" -Recurse -Force -ErrorAction SilentlyContinue;
12-
New-Item -Path "$cwd\build" -ItemType Directory;
12+
New-Item -Path "$cwd\build" -ItemType Directory -Force | Out-Null;
1313

1414
# Download AutoHotkey
1515
$ahkFileNamePattern = "AutoHotkey_.*\.zip"
@@ -55,17 +55,32 @@ Expand-Archive -Path "$cwd\build\$wixFileNamePattern" -DestinationPath "$cwd\bui
5555
Write-Host "Downloaded the latest release from Wix3 into `"$cwd\build\wix\`"" -ForegroundColor Green;
5656

5757
# Build polygon executables
58-
& "$cwd\build\ahk\Ahk2Exe.exe" /in polygon.ahk /out "$cwd\build\polygon-x64.exe" /compress 2 /icon logo.ico /base "$cwd\build\ahk\AutoHotkey64.exe";
59-
& "$cwd\build\ahk\Ahk2Exe.exe" /in polygon.ahk /out "$cwd\build\polygon-x86.exe" /compress 2 /icon logo.ico /base "$cwd\build\ahk\AutoHotkey32.exe";
58+
Start-Process -FilePath "$cwd\build\ahk\Ahk2Exe.exe" -NoNewWindow -Wait -ArgumentList "/in polygon.ahk /out ""$cwd\build\polygon-x86.exe"" /compress 2 /icon logo.ico /base ""$cwd\build\ahk\AutoHotkey32.exe"""
59+
Start-Process -FilePath "$cwd\build\ahk\Ahk2Exe.exe" -NoNewWindow -Wait -ArgumentList "/in polygon.ahk /out ""$cwd\build\polygon-x64.exe"" /compress 2 /icon logo.ico /base ""$cwd\build\ahk\AutoHotkey64.exe""";
6060

6161
Write-Host "Polygon binaries built successfully into `"$cwd\build\`"" -ForegroundColor Green;
6262

63+
# Generate checksums
64+
$checksumFile = "$cwd\build\polygon-checksum.txt";
65+
$hash_x86 = Get-FileHash -Path "$cwd\build\polygon-x86.exe" -Algorithm SHA256;
66+
$hash_x64 = Get-FileHash -Path "$cwd\build\polygon-x64.exe" -Algorithm SHA256;
67+
"polygon-x86.exe: $($hash_x86.Hash)".ToLower() | Out-File -Append -FilePath $checksumFile;
68+
"polygon-x64.exe: $($hash_x64.Hash)".ToLower() | Out-File -Append -FilePath $checksumFile;
69+
70+
Write-Host "Polygon binary checksums calculated successfully into `"$cwd\build\`"" -ForegroundColor Green;
71+
72+
# Create Polygon archives
73+
Compress-Archive -Path "$cwd\polygon.ini","$cwd\build\polygon-x86.exe" -DestinationPath "$cwd\build\polygon-x86.zip";
74+
Compress-Archive -Path "$cwd\polygon.ini","$cwd\build\polygon-x64.exe" -DestinationPath "$cwd\build\polygon-x64.zip";
75+
76+
Write-Host "Polygon archives successfully generated into `"$cwd\build\`"" -ForegroundColor Green;
77+
6378
# Build polygon installer object file
64-
& "$cwd\build\wix\candle.exe" .\polygon.wxs -out "$cwd\build\polygon-x86.wixobj" -dVersion="$versionNumber" -arch x86;
65-
& "$cwd\build\wix\candle.exe" .\polygon.wxs -out "$cwd\build\polygon-x64.wixobj" -dVersion="$versionNumber" -arch x64;
79+
Start-Process -FilePath "$cwd\build\wix\candle.exe" -NoNewWindow -Wait -ArgumentList ".\polygon.wxs -out ""$cwd\build\polygon-x86.wixobj"" -dVersion=""$versionNumber"" -arch x86";
80+
Start-Process -FilePath "$cwd\build\wix\candle.exe" -NoNewWindow -Wait -ArgumentList ".\polygon.wxs -out ""$cwd\build\polygon-x64.wixobj"" -dVersion=""$versionNumber"" -arch x64";
6681

6782
# Build polygon installer MSI
68-
& "$cwd\build\wix\light.exe" "$cwd\build\polygon-x86.wixobj" -ext WixUIExtension -out "$cwd\build\polygon-x86.msi";
69-
& "$cwd\build\wix\light.exe" "$cwd\build\polygon-x64.wixobj" -ext WixUIExtension -out "$cwd\build\polygon-x64.msi";
83+
Start-Process -FilePath "$cwd\build\wix\light.exe" -NoNewWindow -Wait -ArgumentList """$cwd\build\polygon-x86.wixobj"" -ext WixUIExtension -out ""$cwd\build\polygon-x86.msi""";
84+
Start-Process -FilePath "$cwd\build\wix\light.exe" -NoNewWindow -Wait -ArgumentList """$cwd\build\polygon-x64.wixobj"" -ext WixUIExtension -out ""$cwd\build\polygon-x64.msi""";
7085

7186
Write-Host "Polygon installers built successfully into `"$cwd\build\`"" -ForegroundColor Green;

0 commit comments

Comments
 (0)