|
| 1 | +name: "Dep: Package LLVM (Windows host)" |
| 2 | + |
| 3 | +# Repackages the official LLVM Windows release into Stride.Dependencies.LLVM.Windows. |
| 4 | +# No build from source: downloads clang+llvm-<ver>-x86_64-pc-windows-msvc.tar.xz from |
| 5 | +# the upstream GitHub release and keeps only the three binaries Stride.Native.targets |
| 6 | +# invokes on Windows hosts. clang-cl/lld-link/ld.lld/ld64.lld are the same executables |
| 7 | +# dispatching on argv[0], so shipping clang.exe + lld.exe covers every driver via |
| 8 | +# --driver-mode / -flavor flags. |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + llvm-version: |
| 14 | + description: LLVM release version (tag llvmorg-<version> on llvm/llvm-project) |
| 15 | + default: 22.1.2 |
| 16 | + required: true |
| 17 | + version: |
| 18 | + description: Package version (blank = today's date) |
| 19 | + default: '' |
| 20 | + |
| 21 | +jobs: |
| 22 | + pack: |
| 23 | + name: Repackage LLVM ${{ github.event.inputs.llvm-version }} |
| 24 | + # Windows runner for the preinstalled nuget.exe (nuspec-based pack, no csproj). |
| 25 | + runs-on: windows-2025-vs2026 |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + sparse-checkout: build/deps/llvm-windows |
| 30 | + |
| 31 | + - name: Download and extract official release |
| 32 | + shell: bash |
| 33 | + run: | |
| 34 | + V="${{ github.event.inputs.llvm-version }}" |
| 35 | + URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-$V/clang+llvm-$V-x86_64-pc-windows-msvc.tar.xz" |
| 36 | + echo "Downloading $URL" |
| 37 | + curl -fsSL -o llvm.tar.xz "$URL" |
| 38 | + DEST=build/deps/llvm-windows/tools/win-x64 |
| 39 | + mkdir -p "$DEST" |
| 40 | + tar -xJf llvm.tar.xz -C "$DEST" --strip-components=2 \ |
| 41 | + "clang+llvm-$V-x86_64-pc-windows-msvc/bin/clang.exe" \ |
| 42 | + "clang+llvm-$V-x86_64-pc-windows-msvc/bin/lld.exe" \ |
| 43 | + "clang+llvm-$V-x86_64-pc-windows-msvc/bin/llvm-ar.exe" |
| 44 | + { |
| 45 | + printf 'LLVM %s (official upstream release, repackaged)\n' "$V" |
| 46 | + printf 'Source: https://github.com/llvm/llvm-project/releases/tag/llvmorg-%s\n' "$V" |
| 47 | + printf 'Package: clang+llvm-%s-x86_64-pc-windows-msvc.tar.xz (bin/clang.exe, bin/lld.exe, bin/llvm-ar.exe)\n' "$V" |
| 48 | + printf '\n' |
| 49 | + printf 'Stride: %s/%s @ %s\n' "${{ github.server_url }}" "${{ github.repository }}" "${{ github.sha }}" |
| 50 | + printf 'Packaged: %s\n' "$(date -u +%Y-%m-%d)" |
| 51 | + printf 'Workflow: %s/%s/actions/runs/%s\n' "${{ github.server_url }}" "${{ github.repository }}" "${{ github.run_id }}" |
| 52 | + } > "$DEST/VERSION.txt" |
| 53 | + ls -la "$DEST" |
| 54 | +
|
| 55 | + - name: Pack NuGet |
| 56 | + shell: pwsh |
| 57 | + run: | |
| 58 | + $version = "${{ github.event.inputs.version }}" |
| 59 | + if (-not $version) { $version = (Get-Date -Format "yyyy.M.d") } |
| 60 | + nuget pack build/deps/llvm-windows/Stride.Dependencies.LLVM.Windows.nuspec ` |
| 61 | + -Version $version ` |
| 62 | + -Properties "llvmVersion=${{ github.event.inputs.llvm-version }}" ` |
| 63 | + -BasePath build/deps/llvm-windows ` |
| 64 | + -OutputDirectory nupkg |
| 65 | + echo "PACKAGE_VERSION=$version" >> $env:GITHUB_ENV |
| 66 | +
|
| 67 | + - name: Upload package artifact |
| 68 | + uses: actions/upload-artifact@v4 |
| 69 | + with: |
| 70 | + name: Stride.Dependencies.LLVM.Windows.nupkg |
| 71 | + path: nupkg/*.nupkg |
| 72 | + |
| 73 | + publish: |
| 74 | + name: Sign & Publish to NuGet.org |
| 75 | + needs: pack |
| 76 | + runs-on: windows-2025-vs2026 |
| 77 | + environment: production |
| 78 | + steps: |
| 79 | + - name: Install signing tool |
| 80 | + run: dotnet tool install sign --tool-path ./sign-tool --version 0.9.0-beta.23127.3 |
| 81 | + |
| 82 | + - name: Download artifact |
| 83 | + uses: actions/download-artifact@v4 |
| 84 | + with: |
| 85 | + name: Stride.Dependencies.LLVM.Windows.nupkg |
| 86 | + |
| 87 | + - name: Sign NuGet package |
| 88 | + shell: pwsh |
| 89 | + run: | |
| 90 | + ./sign-tool/sign code azure-key-vault *.nupkg ` |
| 91 | + --description "Stride" ` |
| 92 | + --description-url "https://stride3d.net" ` |
| 93 | + --publisher-name "Stride" ` |
| 94 | + --azure-key-vault-tenant-id "${{ secrets.STRIDE_SIGN_TENANT_ID }}" ` |
| 95 | + --azure-key-vault-client-id "${{ secrets.STRIDE_SIGN_CLIENT_ID }}" ` |
| 96 | + --azure-key-vault-client-secret "${{ secrets.STRIDE_SIGN_CLIENT_SECRET }}" ` |
| 97 | + --azure-key-vault-certificate "${{ secrets.STRIDE_SIGN_KEYVAULT_CERTIFICATE }}" ` |
| 98 | + --azure-key-vault-url "https://${{ secrets.STRIDE_SIGN_KEYVAULT_NAME }}.vault.azure.net/" ` |
| 99 | + -v Information |
| 100 | +
|
| 101 | + - name: Publish |
| 102 | + run: | |
| 103 | + dotnet nuget push *.nupkg --api-key "${{ secrets.STRIDE_NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate |
0 commit comments