Skip to content

Commit 1d7f3b6

Browse files
authored
Add Windows release artifacts (#6445)
1 parent 10b054f commit 1d7f3b6

4 files changed

Lines changed: 182 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 92 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: 'Release version'
7+
description: "Release version"
88
required: true
99
type: string
1010
title:
11-
description: 'Release title'
11+
description: "Release title"
1212
required: true
1313
type: string
1414

@@ -198,6 +198,88 @@ jobs:
198198
retention-days: 2
199199
if-no-files-found: error
200200

201+
build-windows:
202+
name: Build Windows ${{ matrix.arch-display-name }} Installer
203+
needs: prepare-release
204+
runs-on: windows-${{ matrix.windows-version }}
205+
env:
206+
SWIFT_VERSION: development
207+
SWIFT_BUILD: DEVELOPMENT-SNAPSHOT-2026-01-09-a
208+
strategy:
209+
fail-fast: false
210+
matrix:
211+
include:
212+
- windows-version: 2025
213+
arch-display-name: AMD64
214+
arch: amd64
215+
wix-platform: x64
216+
target-triple: x86_64-unknown-windows-msvc
217+
- windows-version: "11-arm"
218+
arch-display-name: ARM64
219+
arch: arm64
220+
wix-platform: arm64
221+
target-triple: aarch64-unknown-windows-msvc
222+
permissions:
223+
contents: read
224+
steps:
225+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
226+
with:
227+
ref: ${{ env.RELEASE_BRANCH }}
228+
persist-credentials: false
229+
- name: Set up Swift
230+
uses: compnerd/gha-setup-swift@main
231+
with:
232+
swift-version: ${{ env.SWIFT_VERSION }}
233+
swift-build: ${{ env.SWIFT_BUILD }}
234+
build_arch: ${{ matrix.arch }}
235+
- name: Build static executable
236+
shell: pwsh
237+
run: |
238+
$sdk = Join-Path (Split-Path -Path $env:SDKROOT -Parent) 'WindowsExperimental.sdk'
239+
swift build `
240+
-c release `
241+
--product swiftlint `
242+
--triple ${{ matrix.target-triple }} `
243+
-debug-info-format none `
244+
-Xswiftc -static-stdlib `
245+
-Xswiftc -sdk `
246+
-Xswiftc $sdk `
247+
-Xlinker /NODEFAULTLIB:curl -Xlinker libcurl.lib `
248+
-Xlinker /NODEFAULTLIB:xml2 -Xlinker libxml2s.lib `
249+
-Xlinker zlibstatic.lib `
250+
-Xlinker brotlidec.lib `
251+
-Xlinker brotlicommon.lib
252+
- name: Prepare artifacts directory
253+
shell: pwsh
254+
run: |
255+
New-Item -ItemType Directory -Path artifacts -Force | Out-Null
256+
Copy-Item ".build/${{ matrix.target-triple }}/release/swiftlint.exe" "artifacts/swiftlint.exe" -Force
257+
- name: Create portable zip
258+
shell: pwsh
259+
run: |
260+
Compress-Archive -Path "artifacts/swiftlint.exe" -DestinationPath "artifacts/SwiftLint.${{ matrix.arch }}.zip" -Force
261+
- name: Setup MSBuild
262+
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
263+
- name: Build WiX MSI
264+
shell: pwsh
265+
run: |
266+
& msbuild -nologo `
267+
Platforms\Windows\SwiftLint.wixproj `
268+
-p:Configuration=Release `
269+
-p:InstallerPlatform=${{ matrix.wix-platform }} `
270+
-p:ProductVersion=${{ inputs.version }} `
271+
-p:SwiftLintBuildDir=${{ github.workspace }}\.build\${{ matrix.target-triple }}\release `
272+
-p:OutputPath=${{ github.workspace }}\artifacts `
273+
-p:RunWixToolsOutOfProc=true
274+
Move-Item -Path "artifacts\SwiftLint.msi" -Destination "artifacts\SwiftLint.${{ matrix.arch }}.msi" -Force
275+
- name: Upload artifacts
276+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
277+
with:
278+
name: swiftlint-windows-${{ matrix.arch }}
279+
path: artifacts
280+
retention-days: 2
281+
if-no-files-found: error
282+
201283
create-release:
202284
name: Create Release
203285
needs:
@@ -206,6 +288,7 @@ jobs:
206288
- build-linux
207289
- build-static-linux
208290
- build-macos
291+
- build-windows
209292
runs-on: macOS-26
210293
permissions:
211294
actions: read
@@ -223,17 +306,23 @@ jobs:
223306
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
224307
- name: Move artifacts
225308
run: |
309+
# Move macOS artifacts.
226310
mv -f swiftlint-macos/* .
311+
312+
# Move Linux artifacts.
227313
mv -f swiftlint-linux-amd64/swiftlint swiftlint_linux_amd64
228314
mv -f swiftlint-linux-arm64/swiftlint swiftlint_linux_arm64
229315
mv -f swiftlint-static-amd64/swiftlint swiftlint_static_amd64
230316
mv -f swiftlint-static-arm64/swiftlint swiftlint_static_arm64
231317
232318
# Just pick one of the licenses.
233319
mv -f swiftlint-static-amd64/LICENSE.mimalloc .
320+
321+
# Move Windows artifacts.
322+
mv -f swiftlint-windows-{arm,amd}64/*.{msi,zip} .
234323
- name: Make binaries executable
235324
run: chmod +x swiftlint*
236-
- name: Create artifacts
325+
- name: Package artifacts
237326
run: |
238327
make --debug spm_artifactbundle
239328
make --debug package
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="WixToolset.Sdk/6.0.2">
2+
<PropertyGroup>
3+
<OutputType>Package</OutputType>
4+
<ProductName>SwiftLint</ProductName>
5+
<PackageName>SwiftLint</PackageName>
6+
<DefineConstants>
7+
ProductVersion=$(ProductVersion);
8+
SwiftLintBuildDir=$(SwiftLintBuildDir)
9+
</DefineConstants>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="WixToolset.UI.wixext" Version="6.0.2" />
14+
</ItemGroup>
15+
</Project>

Platforms/Windows/SwiftLint.wxs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<Wix
2+
xmlns="http://wixtoolset.org/schemas/v4/wxs"
3+
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">
4+
5+
<Package
6+
Name="SwiftLint"
7+
Manufacturer="SwiftLint"
8+
Version="$(var.ProductVersion)"
9+
UpgradeCode="{83C6C6DC-BE70-4788-B79A-2BAA8F1F5FBF}"
10+
Language="1033">
11+
12+
<MajorUpgrade DowngradeErrorMessage="A newer version of SwiftLint is already installed." />
13+
14+
<StandardDirectory Id="ProgramFiles64Folder">
15+
<Directory Id="INSTALLFOLDER" Name="SwiftLint" />
16+
</StandardDirectory>
17+
18+
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
19+
<Component>
20+
<File Id="SwiftLintExe" Source="$(var.SwiftLintBuildDir)\swiftlint.exe" KeyPath="yes" />
21+
</Component>
22+
</ComponentGroup>
23+
24+
<ComponentGroup Id="EnvironmentVariables">
25+
<Component
26+
Id="SystemEnvironmentVariables"
27+
Condition="ALLUSERS=1"
28+
Directory="INSTALLFOLDER"
29+
Guid="A271C9AE-1BDC-4D27-B4A1-5195479C8D86">
30+
<Environment
31+
Id="SystemPath"
32+
Action="set"
33+
Name="Path"
34+
Part="last"
35+
Permanent="no"
36+
System="yes"
37+
Value="[INSTALLFOLDER]"
38+
/>
39+
</Component>
40+
<Component
41+
Id="UserEnvironmentVariables"
42+
Condition="NOT ALLUSERS=1"
43+
Directory="INSTALLFOLDER"
44+
Guid="1C384F6C-8779-4575-9723-CCB20C6DFFB6">
45+
<Environment
46+
Id="UserPath"
47+
Action="set"
48+
Name="Path"
49+
Part="last"
50+
Permanent="no"
51+
System="no"
52+
Value="[INSTALLFOLDER]"
53+
/>
54+
</Component>
55+
</ComponentGroup>
56+
57+
<Feature Id="MainFeature" Title="SwiftLint" Level="1">
58+
<ComponentGroupRef Id="ProductComponents" />
59+
<ComponentGroupRef Id="EnvironmentVariables" />
60+
</Feature>
61+
62+
<UI>
63+
<ui:WixUI Id="WixUI_InstallDir" />
64+
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2" />
65+
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" />
66+
</UI>
67+
68+
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"></Property>
69+
</Package>
70+
</Wix>

tools/create-github-release.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,13 @@ gh release create "$version" --title "$release_title" -F "$release_notes" --draf
1616
"bazel.tar.gz" \
1717
"bazel.tar.gz.sha256" \
1818
"portable_swiftlint.zip#Universal macOS Binary" \
19+
"SwiftLint.pkg#Universal macOS Installer" \
1920
"swiftlint_linux_amd64.zip#AMD64 Linux Binary" \
2021
"swiftlint_linux_arm64.zip#ARM64 Linux Binary" \
21-
"SwiftLint.pkg#Universal macOS Installer" \
22+
"SwiftLint.amd64.zip#AMD64 Windows Binary" \
23+
"SwiftLint.arm64.zip#ARM64 Windows Binary" \
24+
"SwiftLint.amd64.msi#AMD64 Windows Installer" \
25+
"SwiftLint.arm64.msi#ARM64 Windows Installer" \
2226
"SwiftLintBinary.artifactbundle.zip"
2327

2428
rm "$release_notes"

0 commit comments

Comments
 (0)