247
247
required : true
248
248
PASSPHRASE :
249
249
required : true
250
+ R2_ACCOUNT_ID :
251
+ required : true
252
+ R2_ACCESS_KEY_ID :
253
+ required : true
254
+ R2_SECRET_ACCESS_KEY :
255
+ required : true
250
256
251
257
env :
252
258
PINNED_BOOTSTRAP_TOOLCHAIN_VERSION : 6.1.2
@@ -5032,7 +5038,7 @@ jobs:
5032
5038
-p:ProductVersion=${{ inputs.swift_version }}-${{ inputs.swift_tag }} `
5033
5039
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/shared/shared.wixproj
5034
5040
5035
- - name : Build installer bundle
5041
+ - name : Build installer bundle (offline)
5036
5042
run : |
5037
5043
$Platforms=@("windows")
5038
5044
if ("${{ inputs.build_android }}" -eq "true") {
@@ -5055,26 +5061,109 @@ jobs:
5055
5061
-p:ToolchainVariants="`"asserts;noasserts`"" `
5056
5062
${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/bundle/installer.wixproj
5057
5063
5058
- - if : ${{ inputs.release }}
5064
+ - name : Generate Build Provenance (offline installer)
5065
+ if : ${{ inputs.release }}
5059
5066
uses : actions/attest-build-provenance@v2
5060
5067
with :
5061
5068
subject-path : ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/installer.exe
5062
5069
5063
- - uses : actions/upload-artifact@v4
5070
+ - name : Upload installer (offline)
5071
+ uses : actions/upload-artifact@v4
5072
+ with :
5073
+ name : Windows-${{ matrix.arch }}-installer-offline
5074
+ path : ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/installer.exe
5075
+
5076
+ - name : Generate online installer download URL
5077
+ if : ${{ inputs.release }}
5078
+ id : generate-base-release-download-subcomponent
5079
+ run : |
5080
+ $BaseReleaseDownloadUrlSubcomponent = "${{ inputs.swift_tag }}/${{ matrix.arch }}/${{ github.run_id }}"
5081
+ echo "url_subcomponent=$BaseReleaseDownloadUrlSubcomponent" >> $env:GITHUB_OUTPUT
5082
+
5083
+ - name : Build installer bundle (online)
5084
+ if : ${{ inputs.release }}
5085
+ run : |
5086
+ $Platforms=@("windows")
5087
+ if ("${{ inputs.build_android }}" -eq "true") {
5088
+ $Platforms=@("android") + $Platforms
5089
+ }
5090
+ $BaseReleaseDownloadUrl = "https://swift-toolchain.thebrowserco.com/${{ steps.generate-base-release-download-subcomponent.outputs.url_subcomponent }}"
5091
+
5092
+ msbuild -nologo -restore -maxCpuCount `
5093
+ /t:rebuild `
5094
+ -p:BaseOutputPath=${{ github.workspace }}\BinaryCache\installer\ `
5095
+ -p:Configuration=Release `
5096
+ -p:BuildProjectReferences=false `
5097
+ -p:SignOutput=${{ inputs.signed }} `
5098
+ -p:CERTIFICATE=${env:CERTIFICATE} `
5099
+ -p:PASSPHRASE=${{ secrets.PASSPHRASE }} `
5100
+ -p:BundleFlavor=online `
5101
+ -p:BaseReleaseDownloadUrl=$BaseReleaseDownloadUrl `
5102
+ -p:Platforms="`"$($Platforms -Join ';')`"" `
5103
+ -p:AndroidArchitectures="`"aarch64;armv7;i686;x86_64`"" `
5104
+ -p:WindowsArchitectures="`"aarch64;i686;x86_64`"" `
5105
+ -p:ProductArchitecture=${{ matrix.arch }} `
5106
+ -p:ProductVersion=${{ inputs.swift_version }}-${{ inputs.swift_tag }} `
5107
+ -p:ToolchainVariants="`"asserts;noasserts`"" `
5108
+ ${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/bundle/installer.wixproj
5109
+
5110
+ - name : Prepare layout for upload
5111
+ id : prepare-layout
5112
+ if : ${{ inputs.release }}
5113
+ run : |
5114
+ # Create the target folder.
5115
+ $SourceDir = "${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}"
5116
+ $LayoutDir = "${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/layout"
5117
+ New-Item -ItemType Directory -Path $LayoutDir -Force | Out-Null
5118
+
5119
+ # Copy all .txt files from src to the filtered directory
5120
+ Copy-Item -Path "$SourceDir/installer.exe" -Destination "$LayoutDir" -Force
5121
+ Copy-Item -Path "$SourceDir/*.cab" -Destination "$LayoutDir" -Force
5122
+ Copy-Item -Path "$SourceDir/*.msi" -Destination "$LayoutDir" -Force
5123
+
5124
+ echo "LayoutDir=$LayoutDir"
5125
+ echo "LayoutDir=$LayoutDir" >> $env:GITHUB_OUTPUT
5126
+
5127
+ - name : Generate Build Provenance (online installer)
5128
+ if : ${{ inputs.release }}
5129
+ uses : actions/attest-build-provenance@v2
5064
5130
with :
5065
- name : Windows-${{ matrix.arch }}-installer
5131
+ subject-path : ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/installer.exe
5132
+
5133
+ - name : Upload installer (online)
5134
+ if : ${{ inputs.release }}
5135
+ uses : actions/upload-artifact@v4
5136
+ with :
5137
+ name : Windows-${{ matrix.arch }}-installer-online
5066
5138
path : ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/installer.exe
5067
5139
5140
+ - name : Upload msi's and cab's
5141
+ if : ${{ inputs.release }}
5142
+ env :
5143
+ SOURCE_DIR : ${{ steps.prepare-layout.outputs.LayoutDir }}
5144
+ DESTINATION_PREFIX : ${{ steps.generate-base-release-download-subcomponent.outputs.url_subcomponent }}
5145
+ R2_BUCKET : swift-toolchain
5146
+ AWS_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
5147
+ AWS_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
5148
+ AWS_DEFAULT_REGION : auto
5149
+ R2_ENDPOINT_URL : https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com
5150
+ run : |
5151
+ aws s3 sync "${env:SOURCE_DIR}" "s3://${env:R2_BUCKET}/${env:DESTINATION_PREFIX}/" `
5152
+ --endpoint-url "${env:R2_ENDPOINT_URL}" `
5153
+ --no-progress `
5154
+ --acl private
5155
+
5068
5156
smoke_test :
5069
5157
# TODO: Build this on macOS or make an equivalent Mac-only job
5070
5158
if : inputs.build_os == 'Windows'
5071
5159
needs : [installer]
5072
5160
runs-on : ${{ inputs.default_build_runner }}
5073
5161
5074
5162
steps :
5075
- - uses : actions/download-artifact@v4
5163
+ - name : Download Swift SDK Installer (${{ inputs.release && 'online' || 'offline' }})
5164
+ uses : actions/download-artifact@v4
5076
5165
with :
5077
- name : Windows-${{ inputs.build_arch }}-installer
5166
+ name : Windows-${{ inputs.build_arch }}-installer-${{ inputs.release && 'online' || 'offline' }}
5078
5167
path : ${{ github.workspace }}/tmp
5079
5168
5080
5169
# TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
@@ -5136,10 +5225,10 @@ jobs:
5136
5225
arch : [ x86_64, aarch64 ]
5137
5226
5138
5227
steps :
5139
- - name : Download Swift SDK
5228
+ - name : Download Swift SDK Installer (${{ inputs.release && 'online' || 'offline' }})
5140
5229
uses : actions/download-artifact@v4
5141
5230
with :
5142
- name : Windows-${{ inputs.build_arch }}-installer
5231
+ name : Windows-${{ inputs.build_arch }}-installer-${{ inputs.release && 'online' || 'offline' }}
5143
5232
path : ${{ github.workspace }}/tmp
5144
5233
5145
5234
# TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
0 commit comments