-
Notifications
You must be signed in to change notification settings - Fork 637
80 lines (67 loc) · 2.63 KB
/
windows_release.yml
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
name: Build for Windows
on:
workflow_dispatch:
inputs:
revision:
description: 'Revision to build (branch, tag, or SHA)'
required: false
default: 'main'
version:
description: 'Version being released'
required: false
default: '0.0.0'
jobs:
build:
name: Build SwiftFormat for Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- target-triple: x86_64-unknown-windows-msvc
product-arch: amd64
- target-triple: aarch64-unknown-windows-msvc
product-arch: arm64
steps:
- uses: compnerd/gha-setup-swift@main
with:
tag: 5.10.1-RELEASE # The 5.10 installer is the first that includes the Swift runtime msm files.
branch: swift-5.10.1-release
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.revision }}
- run: swift build -c release --triple ${{ matrix.target-triple }} -Xswiftc -gnone
- uses: microsoft/[email protected]
- shell: pwsh
run: |
# Bundle the Swift runtime if the version we're using ships with a redistributable
$SwiftExePath = (& where.exe swift.exe)
if (-not ($SwiftExePath -match "(.+)\\Toolchains\\(\d+\.\d+\.\d+)[^\\]*\\.*")) {
throw "Unexpected Swift installation path format"
}
$SwiftInstallRoot = $Matches[1]
$SwiftRuntimeVersion = $Matches[2]
$SwiftRedistDir = "$SwiftInstallRoot\Redistributables\$SwiftRuntimeVersion"
if (-not (Test-Path $SwiftRedistDir)) {
throw "Swift redistributable not found at $SwiftRedistDir"
}
& msbuild -nologo -restore Platforms\Windows\SwiftFormat.wixproj `
-p:Configuration=Release `
-p:ProductArchitecture=${{ matrix.product-arch }} `
-p:ProductVersion=${{ github.event.inputs.version }} `
-p:SwiftFormatBuildDir=${{ github.workspace }}\.build\${{ matrix.target-triple }}\release `
-p:SwiftRedistDir=$SwiftRedistDir `
-p:OutputPath=${{ github.workspace }}\artifacts `
-p:RunWixToolsOutOfProc=true
- name: 'Upload EXE'
uses: actions/upload-artifact@v4
with:
name: swiftformat.${{ matrix.product-arch }}.exe
path: .build/${{ matrix.target-triple }}/release/swiftformat.exe
retention-days: 5
- name: 'Upload MSI'
uses: actions/upload-artifact@v4
with:
name: SwiftFormat.${{ matrix.product-arch }}.msi
path: artifacts\SwiftFormat.msi
retention-days: 5