Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 92 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
description: "Release version"
required: true
type: string
title:
description: 'Release title'
description: "Release title"
required: true
type: string

Expand Down Expand Up @@ -198,6 +198,88 @@ jobs:
retention-days: 2
if-no-files-found: error

build-windows:
name: Build Windows ${{ matrix.arch-display-name }} Installer
needs: prepare-release
runs-on: windows-${{ matrix.windows-version }}
env:
SWIFT_VERSION: development
SWIFT_BUILD: DEVELOPMENT-SNAPSHOT-2026-01-09-a
strategy:
fail-fast: false
matrix:
include:
- windows-version: 2025
arch-display-name: AMD64
arch: amd64
wix-platform: x64
target-triple: x86_64-unknown-windows-msvc
- windows-version: "11-arm"
arch-display-name: ARM64
arch: arm64
wix-platform: arm64
target-triple: aarch64-unknown-windows-msvc
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ env.RELEASE_BRANCH }}
persist-credentials: false
- name: Set up Swift
uses: compnerd/gha-setup-swift@main
with:
swift-version: ${{ env.SWIFT_VERSION }}
swift-build: ${{ env.SWIFT_BUILD }}
build_arch: ${{ matrix.arch }}
- name: Build static executable
shell: pwsh
run: |
$sdk = Join-Path (Split-Path -Path $env:SDKROOT -Parent) 'WindowsExperimental.sdk'
swift build `
-c release `
--product swiftlint `
--triple ${{ matrix.target-triple }} `
-debug-info-format none `
-Xswiftc -static-stdlib `
-Xswiftc -sdk `
-Xswiftc $sdk `
-Xlinker /NODEFAULTLIB:curl -Xlinker libcurl.lib `
-Xlinker /NODEFAULTLIB:xml2 -Xlinker libxml2s.lib `
-Xlinker zlibstatic.lib `
-Xlinker brotlidec.lib `
-Xlinker brotlicommon.lib
- name: Prepare artifacts directory
shell: pwsh
run: |
New-Item -ItemType Directory -Path artifacts -Force | Out-Null
Copy-Item ".build/${{ matrix.target-triple }}/release/swiftlint.exe" "artifacts/swiftlint.exe" -Force
- name: Create portable zip
shell: pwsh
run: |
Compress-Archive -Path "artifacts/swiftlint.exe" -DestinationPath "artifacts/SwiftLint.${{ matrix.arch }}.zip" -Force
- name: Setup MSBuild
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2
- name: Build WiX MSI
shell: pwsh
run: |
& msbuild -nologo `
Platforms\Windows\SwiftLint.wixproj `
-p:Configuration=Release `
-p:InstallerPlatform=${{ matrix.wix-platform }} `
-p:ProductVersion=${{ inputs.version }} `
-p:SwiftLintBuildDir=${{ github.workspace }}\.build\${{ matrix.target-triple }}\release `
-p:OutputPath=${{ github.workspace }}\artifacts `
-p:RunWixToolsOutOfProc=true
Move-Item -Path "artifacts\SwiftLint.msi" -Destination "artifacts\SwiftLint.${{ matrix.arch }}.msi" -Force
- name: Upload artifacts
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: swiftlint-windows-${{ matrix.arch }}
path: artifacts
retention-days: 2
if-no-files-found: error

create-release:
name: Create Release
needs:
Expand All @@ -206,6 +288,7 @@ jobs:
- build-linux
- build-static-linux
- build-macos
- build-windows
runs-on: macOS-26
permissions:
actions: read
Expand All @@ -223,17 +306,23 @@ jobs:
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
- name: Move artifacts
run: |
# Move macOS artifacts.
mv -f swiftlint-macos/* .

# Move Linux artifacts.
mv -f swiftlint-linux-amd64/swiftlint swiftlint_linux_amd64
mv -f swiftlint-linux-arm64/swiftlint swiftlint_linux_arm64
mv -f swiftlint-static-amd64/swiftlint swiftlint_static_amd64
mv -f swiftlint-static-arm64/swiftlint swiftlint_static_arm64

# Just pick one of the licenses.
mv -f swiftlint-static-amd64/LICENSE.mimalloc .

# Move Windows artifacts.
mv -f swiftlint-windows-{arm,amd}64/*.{msi,zip} .
- name: Make binaries executable
run: chmod +x swiftlint*
- name: Create artifacts
- name: Package artifacts
run: |
make --debug spm_artifactbundle
make --debug package
Expand Down
15 changes: 15 additions & 0 deletions Platforms/Windows/SwiftLint.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="WixToolset.Sdk/6.0.2">
<PropertyGroup>
<OutputType>Package</OutputType>
<ProductName>SwiftLint</ProductName>
<PackageName>SwiftLint</PackageName>
<DefineConstants>
ProductVersion=$(ProductVersion);
SwiftLintBuildDir=$(SwiftLintBuildDir)
</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="WixToolset.UI.wixext" Version="6.0.2" />
</ItemGroup>
</Project>
70 changes: 70 additions & 0 deletions Platforms/Windows/SwiftLint.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<Wix
xmlns="http://wixtoolset.org/schemas/v4/wxs"
xmlns:ui="http://wixtoolset.org/schemas/v4/wxs/ui">

<Package
Name="SwiftLint"
Manufacturer="SwiftLint"
Version="$(var.ProductVersion)"
UpgradeCode="{83C6C6DC-BE70-4788-B79A-2BAA8F1F5FBF}"
Language="1033">

<MajorUpgrade DowngradeErrorMessage="A newer version of SwiftLint is already installed." />

<StandardDirectory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="SwiftLint" />
</StandardDirectory>

<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component>
<File Id="SwiftLintExe" Source="$(var.SwiftLintBuildDir)\swiftlint.exe" KeyPath="yes" />
</Component>
</ComponentGroup>

<ComponentGroup Id="EnvironmentVariables">
<Component
Id="SystemEnvironmentVariables"
Condition="ALLUSERS=1"
Directory="INSTALLFOLDER"
Guid="A271C9AE-1BDC-4D27-B4A1-5195479C8D86">
<Environment
Id="SystemPath"
Action="set"
Name="Path"
Part="last"
Permanent="no"
System="yes"
Value="[INSTALLFOLDER]"
/>
</Component>
<Component
Id="UserEnvironmentVariables"
Condition="NOT ALLUSERS=1"
Directory="INSTALLFOLDER"
Guid="1C384F6C-8779-4575-9723-CCB20C6DFFB6">
<Environment
Id="UserPath"
Action="set"
Name="Path"
Part="last"
Permanent="no"
System="no"
Value="[INSTALLFOLDER]"
/>
</Component>
</ComponentGroup>

<Feature Id="MainFeature" Title="SwiftLint" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="EnvironmentVariables" />
</Feature>

<UI>
<ui:WixUI Id="WixUI_InstallDir" />
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg" Order="2" />
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2" />
</UI>

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER"></Property>
</Package>
</Wix>
6 changes: 5 additions & 1 deletion tools/create-github-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ gh release create "$version" --title "$release_title" -F "$release_notes" --draf
"bazel.tar.gz" \
"bazel.tar.gz.sha256" \
"portable_swiftlint.zip#Universal macOS Binary" \
"SwiftLint.pkg#Universal macOS Installer" \
"swiftlint_linux_amd64.zip#AMD64 Linux Binary" \
"swiftlint_linux_arm64.zip#ARM64 Linux Binary" \
"SwiftLint.pkg#Universal macOS Installer" \
"SwiftLint.amd64.zip#AMD64 Windows Binary" \
"SwiftLint.arm64.zip#ARM64 Windows Binary" \
"SwiftLint.amd64.msi#AMD64 Windows Installer" \
"SwiftLint.arm64.msi#ARM64 Windows Installer" \
"SwiftLintBinary.artifactbundle.zip"

rm "$release_notes"