name: Build Windows Release Artifacts on: release: types: [published] workflow_dispatch: inputs: tag: description: 'Release tag (e.g. v1.2.3)' required: true 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: swift-version: development # Note: This snapshot includes the WindowsExperimental.sdk needed for static linking support, # this will be merged into Windows.sdk in the near future and $ExperimentalSDK related flags below will need to be removed swift-build: DEVELOPMENT-SNAPSHOT-2025-08-27-a update-sdk-modules: true - name: Checkout uses: actions/checkout@v5 - shell: pwsh run: | $ExperimentalSDK = "$(Split-Path -Path ${env:SDKROOT} -Parent)/WindowsExperimental.sdk" swift build -c release --triple ${{ matrix.target-triple }} -debug-info-format none -Xswiftc -static-stdlib ` -Xswiftc -sdk -Xswiftc ${ExperimentalSDK} - uses: microsoft/setup-msbuild@v3.0.0 - shell: pwsh run: | & msbuild -nologo -restore Platforms\Windows\SwiftFormat.wixproj ` -p:Configuration=Release ` -p:ProductArchitecture=${{ matrix.product-arch }} ` -p:ProductVersion=${{ github.event.release.tag_name || inputs.tag }} ` -p:SwiftFormatBuildDir=${{ github.workspace }}\.build\${{ matrix.target-triple }}\release ` -p:OutputPath=${{ github.workspace }}\artifacts ` -p:RunWixToolsOutOfProc=true - name: 'Rename MSI file' run: mv artifacts\SwiftFormat.msi artifacts\SwiftFormat.${{ matrix.product-arch }}.msi - 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.${{ matrix.product-arch }}.msi retention-days: 5 upload: name: Upload release artifacts runs-on: ubuntu-latest needs: [build] if: always() steps: - name: Checkout the repository uses: actions/checkout@v5 - uses: actions/download-artifact@v5 with: path: downloaded-artifacts pattern: SwiftFormat.*.msi - name: Display structure of downloaded files run: ls -R downloaded-artifacts - name: Move MSI files to workspace root run: | mv downloaded-artifacts/*.msi ./ rm -rf downloaded-artifacts - name: Display structure of uploadable files run: ls -R . - name: Upload release assets uses: softprops/action-gh-release@v3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.event.release.tag_name || inputs.tag }} files: SwiftFormat.*.msi/SwiftFormat.*.msi