diff --git a/.github/scripts/voice-cygwin-snapshot.json b/.github/scripts/voice-cygwin-snapshot.json index 2e961be6b7..8679adca1e 100644 --- a/.github/scripts/voice-cygwin-snapshot.json +++ b/.github/scripts/voice-cygwin-snapshot.json @@ -32,6 +32,11 @@ "sha512": "7c466da6446bbef67762ff4038dd4986018ed09432bd6ee6ca9e33150874dbb9d61c7e4b06bd925f932a55fda345401224689bbaddc135d7300651f67ec8160b" } ], + "sourceArchive": { + "name": "cygwin-build-sources.tar", + "bytes": 368824320, + "sha256": "13a42ea4e6465f77c32f91e4162f41bcfeab7c0eca47701bb6a8b9aca1eb99f4" + }, "packages": [ {"name": "_autorebase", "version": "001091-1", "file": "noarch/release/_autorebase/_autorebase-001091-1.tar.zst", "bytes": 4696, "sha512": "a9416ce992ca57f3a6208f46517520d21dfac61988ac84cbb5b17b76e053a0845c15368ccb8ca9c483d8935f9e3db81568433c0d08d0265ec5e6916ea30f2831"}, {"name": "alternatives", "version": "1.31-1", "file": "x86_64/release/alternatives/alternatives-1.31-1.tar.xz", "bytes": 123748, "sha512": "94adf3376e7fcaf937594be718f54a99f2a2b66367eb2bb294b6fd4a933a9515954a9e9f309ed74cc62fbb353adb053d8500bbaf42994e4355f7180664afa62c"}, diff --git a/.github/workflows/rust-release-windows.yml b/.github/workflows/rust-release-windows.yml index d67aa445e2..ceb6075287 100644 --- a/.github/workflows/rust-release-windows.yml +++ b/.github/workflows/rust-release-windows.yml @@ -190,14 +190,20 @@ jobs: - name: Download pinned Windows build inputs shell: pwsh env: - GH_TOKEN: ${{ secrets.VOICE_BUILD_INPUTS_TOKEN || github.token }} - INPUTS_REPOSITORY: ${{ vars.VOICE_BUILD_INPUTS_REPOSITORY || github.repository }} + GH_TOKEN: ${{ github.token }} run: | - $pin = (Get-Content -Raw .github/scripts/voice-cygwin-snapshot.json | ConvertFrom-Json).archive + $manifest = Get-Content -Raw .github/scripts/voice-cygwin-snapshot.json | ConvertFrom-Json + $pin = $manifest.archive + $source = $manifest.sourceArchive $directory = Join-Path $env:RUNNER_TEMP "voice-cygwin-snapshot" New-Item -ItemType Directory -Path $directory | Out-Null - gh release download $pin.tag --repo $env:INPUTS_REPOSITORY --pattern $pin.name --dir $directory - if ($LASTEXITCODE -ne 0) { throw "Cannot obtain the pinned Cygwin snapshot from the configured release repository" } + gh release download $pin.tag --repo "${{ github.repository }}" --pattern $pin.name --pattern $source.name --dir $directory + if ($LASTEXITCODE -ne 0) { throw "Cannot obtain the public Cygwin inputs and source" } + $sourceFile = Join-Path $directory $source.name + if ((Get-Item $sourceFile).Length -ne $source.bytes -or + (Get-FileHash $sourceFile -Algorithm SHA256).Hash.ToLowerInvariant() -ne $source.sha256) { + throw "Public Cygwin source archive mismatch" + } "VOICE_CYGWIN_ARCHIVE=$(Join-Path $directory $pin.name)" | Out-File $env:GITHUB_ENV -Encoding utf8 -Append - name: Verify and install pinned public build tools shell: pwsh