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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
|
name: Windows Installer Packaging (Inno Setup)
on:
release:
types: [released]
workflow_dispatch:
inputs:
tag_name:
description: 'Release Tag (e.g., v1.0.0). Leave empty to use "latest".'
required: false
default: ''
jobs:
package-windows:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Version from Cargo.toml
id: get_version
shell: pwsh
run: |
$VersionLine = Get-Content Cargo.toml | Select-String '^version\s*=\s*"(.*)"'
if ($VersionLine.Matches.Success) {
$Version = $VersionLine.Matches.Groups[1].Value
Write-Host "Found version in Cargo.toml: $Version"
"version=$Version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
} else {
Write-Error "Could not find version in Cargo.toml"
exit 1
}
- name: Determine Release Tag
id: get_tag
shell: pwsh
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
$TAG = "${{ inputs.tag_name }}"
if (-not $TAG) { $TAG = "${{ github.event.release.tag_name }}" }
if (-not $TAG) {
Write-Host "No tag provided, fetching latest release..."
$TAG = $(gh release view --json tagName --jq .tagName)
}
if (-not $TAG) {
Write-Error "Could not determine release tag."
exit 1
}
Write-Host "Using Tag: $TAG"
"tag=$TAG" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Download Release Assets
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
$TAG = "${{ steps.get_tag.outputs.tag }}"
$Version = "${{ steps.get_version.outputs.version }}"
# Download the raw binaries
gh release download $TAG -p "mikusays-windows-x86_64-$Version.exe"
gh release download $TAG -p "mikusays-windows-aarch64-$Version.exe"
# Rename to standard names for the Inno Script
mv "mikusays-windows-x86_64-$Version.exe" "mikusays-windows-x86_64.exe"
mv "mikusays-windows-aarch64-$Version.exe" "mikusays-windows-aarch64.exe"
- name: Generate Inno Setup Script
shell: pwsh
run: |
$Version = "${{ steps.get_version.outputs.version }}"
$InstallerName = "mikusays-windows-inst-any-$Version"
Write-Host "Generating Inno Setup script for version: $Version"
$issContent = @'
[Setup]
AppName=mikusays
AppVersion=__VERSION__
AppCopyright=2025 xxanqw
AppPublisher=xxanqw
AppPublisherURL=https://xxanqw.pp.ua/
AppSupportURL=https://github.com/xxanqw/mikusays/issues
AppUpdatesURL=https://github.com/xxanqw/mikusays/releases/latest
AppId={{A0ED7972-D08B-48CB-8331-729D1001FF16}
DefaultDirName={localappdata}\Programs\mikusays
DefaultGroupName=Mikusays
DisableProgramGroupPage=yes
PrivilegesRequired=lowest
; -- Output Configuration --
OutputBaseFilename=__OUTFILE__
OutputDir=.
Compression=lzma2/ultra64
SolidCompression=yes
; -- Architecture Configuration --
ArchitecturesInstallIn64BitMode=x64compatible arm64
ArchitecturesAllowed=x64compatible arm64
ChangesEnvironment=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "mikusays-windows-x86_64.exe"; DestDir: "{app}"; DestName: "mikusays.exe"; Check: IsX64; Flags: ignoreversion
Source: "mikusays-windows-aarch64.exe"; DestDir: "{app}"; DestName: "mikusays.exe"; Check: IsARM64; Flags: ignoreversion
[Icons]
Name: "{group}\Mikusays"; Filename: "{app}\mikusays.exe"
Name: "{group}\Uninstall Mikusays"; Filename: "{uninstallexe}"
[Code]
function IsX64: Boolean;
begin
Result := Is64BitInstallMode and (ProcessorArchitecture = paX64);
end;
function IsARM64: Boolean;
begin
Result := Is64BitInstallMode and (ProcessorArchitecture = paARM64);
end;
const
VC_REDIST_X64_URL = 'https://aka.ms/vs/17/release/vc_redist.x64.exe';
VC_REDIST_ARM64_URL = 'https://aka.ms/vs/17/release/vc_redist.arm64.exe';
var
DownloadPage: TDownloadWizardPage;
procedure InitializeWizard;
begin
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), nil);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
RedistUrl, RedistFile: String;
ResultCode: Integer;
begin
Result := True;
if CurPageID = wpReady then
begin
DownloadPage.Clear;
if IsARM64 then
RedistUrl := VC_REDIST_ARM64_URL
else
RedistUrl := VC_REDIST_X64_URL;
RedistFile := 'vc_redist.exe';
DownloadPage.Add(RedistUrl, RedistFile, '');
DownloadPage.Show;
try
try
DownloadPage.Download;
Exec(ExpandConstant('{tmp}\' + RedistFile), '/install /quiet /norestart', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
except
if MsgBox('Download of Visual C++ Redistributable failed: ' + GetExceptionMessage + #13#10#13#10 + 'Do you want to continue installation anyway?', mbError, MB_YESNO) = IDNO then
Result := False;
end;
finally
DownloadPage.Hide;
end;
end;
end;
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath) then
begin
Result := True;
exit;
end;
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;
procedure RemovePath(Param: string);
var
OrigPath: string;
P: Integer;
begin
if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath) then
exit;
P := Pos(';' + Param + ';', OrigPath);
if P > 0 then
begin
Delete(OrigPath, P + 1, Length(Param) + 1);
RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath);
exit;
end;
if Pos(Param + ';', OrigPath) = 1 then
begin
Delete(OrigPath, 1, Length(Param) + 1);
RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath);
exit;
end;
P := Pos(';' + Param, OrigPath);
if (P > 0) and (P = Length(OrigPath) - Length(Param)) then
begin
Delete(OrigPath, P, Length(Param) + 1);
RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath);
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
OrigPath: string;
begin
if CurStep = ssPostInstall then
begin
if NeedsAddPath(ExpandConstant('{app}')) then
begin
if RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath) then
begin
if OrigPath = '' then
OrigPath := ExpandConstant('{app}')
else
OrigPath := OrigPath + ';' + ExpandConstant('{app}');
end
else
OrigPath := ExpandConstant('{app}');
RegWriteExpandStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', OrigPath);
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then
begin
RemovePath(ExpandConstant('{app}'));
end;
end;
'@
$issContent = $issContent.Replace("__VERSION__", $Version)
$issContent = $issContent.Replace("__OUTFILE__", $InstallerName)
Set-Content -Path "installer.iss" -Value $issContent
- name: List workspace contents for debug
shell: pwsh
run: |
Write-Host "-- Workspace Contents --"
Get-ChildItem -File | ForEach-Object { Write-Host $_.Name }
- name: Compile Installer
shell: cmd
run: '"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer.iss'
- name: Upload Installer to Release
env:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
$TAG = "${{ steps.get_tag.outputs.tag }}"
$Version = "${{ steps.get_version.outputs.version }}"
# With OutputDir=. the file is in root
$UploadFile = "mikusays-windows-inst-any-$Version.exe"
if (-not (Test-Path $UploadFile)) {
Write-Error "Could not find compiled installer at $UploadFile"
Get-ChildItem
exit 1
}
gh release upload $TAG $UploadFile --clobber
|