Skip to content

Commit 58bf89f

Browse files
authored
Update VCPKG GHAs to use head commit id if variable isn't set (#527)
1 parent c0b4743 commit 58bf89f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

.github/workflows/vcpkg.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,28 @@ jobs:
9999
echo "::error Unknown architecture/build-type triplet mapping"
100100
}
101101
102+
- name: Get vcpkg commit hash
103+
shell: pwsh
104+
run: |
105+
if ($Env:vcpkgRelease) {
106+
echo "Using vcpkg commit from repo variable..."
107+
$VCPKG_COMMIT_ID = $Env:vcpkgRelease
108+
}
109+
else {
110+
echo "Fetching latest vcpkg commit hash..."
111+
$commit = (git ls-remote https://github.com/microsoft/vcpkg.git HEAD | Select-String -Pattern '([a-f0-9]{40})').Matches.Value
112+
$VCPKG_COMMIT_ID = $commit
113+
}
114+
Write-Host "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID"
115+
echo "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID" >> $env:GITHUB_ENV
116+
env:
117+
vcpkgRelease: '${{ vars.VCPKG_COMMIT_ID }}'
118+
102119
- uses: lukka/run-vcpkg@7d259227a1fb6471a0253dd5ab7419835228f7d7 # v11
103120
with:
104121
runVcpkgInstall: true
105122
vcpkgJsonGlob: '**/build/vcpkg.json'
106-
vcpkgGitCommitId: '${{ vars.VCPKG_COMMIT_ID }}'
123+
vcpkgGitCommitId: '${{ env.VCPKG_COMMIT_ID }}'
107124

108125
- name: 'Configure CMake'
109126
working-directory: ${{ github.workspace }}

0 commit comments

Comments
 (0)