247247 required : true
248248 PASSPHRASE :
249249 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
250256
251257env :
252258 PINNED_BOOTSTRAP_TOOLCHAIN_VERSION : 6.1.2
@@ -5032,7 +5038,7 @@ jobs:
50325038 -p:ProductVersion=${{ inputs.swift_version }}-${{ inputs.swift_tag }} `
50335039 ${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/shared/shared.wixproj
50345040
5035- - name : Build installer bundle
5041+ - name : Build installer bundle (offline)
50365042 run : |
50375043 $Platforms=@("windows")
50385044 if ("${{ inputs.build_android }}" -eq "true") {
@@ -5055,26 +5061,109 @@ jobs:
50555061 -p:ToolchainVariants="`"asserts;noasserts`"" `
50565062 ${{ github.workspace }}/SourceCache/swift-installer-scripts/platforms/Windows/bundle/installer.wixproj
50575063
5058- - if : ${{ inputs.release }}
5064+ - name : Generate Build Provenance (offline installer)
5065+ if : ${{ inputs.release }}
50595066 uses : actions/attest-build-provenance@v2
50605067 with :
50615068 subject-path : ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/installer.exe
50625069
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
50645130 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
50665138 path : ${{ github.workspace }}/BinaryCache/installer/Release/${{ matrix.arch }}/installer.exe
50675139
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+
50685156 smoke_test :
50695157 # TODO: Build this on macOS or make an equivalent Mac-only job
50705158 if : inputs.build_os == 'Windows'
50715159 needs : [installer]
50725160 runs-on : ${{ inputs.default_build_runner }}
50735161
50745162 steps :
5075- - uses : actions/download-artifact@v4
5163+ - name : Download Swift SDK Installer (${{ inputs.release && 'online' || 'offline' }})
5164+ uses : actions/download-artifact@v4
50765165 with :
5077- name : Windows-${{ inputs.build_arch }}-installer
5166+ name : Windows-${{ inputs.build_arch }}-installer-${{ inputs.release && 'online' || 'offline' }}
50785167 path : ${{ github.workspace }}/tmp
50795168
50805169 # TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
@@ -5136,10 +5225,10 @@ jobs:
51365225 arch : [ x86_64, aarch64 ]
51375226
51385227 steps :
5139- - name : Download Swift SDK
5228+ - name : Download Swift SDK Installer (${{ inputs.release && 'online' || 'offline' }})
51405229 uses : actions/download-artifact@v4
51415230 with :
5142- name : Windows-${{ inputs.build_arch }}-installer
5231+ name : Windows-${{ inputs.build_arch }}-installer-${{ inputs.release && 'online' || 'offline' }}
51435232 path : ${{ github.workspace }}/tmp
51445233
51455234 # TODO(compnerd): migrate this to compnerd/gha-setup-swift after the work that @mangini is doing is completed
0 commit comments