Skip to content

Commit e0f91cd

Browse files
committed
Update VCPKG GHAs to use head commit id if variable isn't set
1 parent 8fa2464 commit e0f91cd

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
@@ -94,11 +94,28 @@ jobs:
9494
echo "::error Unknown architecture/build-type triplet mapping"
9595
}
9696
97+
- name: Get vcpkg commit hash
98+
shell: pwsh
99+
run: |
100+
if ($Env:vcpkgRelease) {
101+
echo "Using vcpkg commit from repo variable..."
102+
$VCPKG_COMMIT_ID = $Env:vcpkgRelease
103+
}
104+
else {
105+
echo "Fetching latest vcpkg commit hash..."
106+
$commit = (git ls-remote https://github.com/microsoft/vcpkg.git HEAD | Select-String -Pattern '([a-f0-9]{40})').Matches.Value
107+
$VCPKG_COMMIT_ID = $commit
108+
}
109+
Write-Host "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID"
110+
echo "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID" >> $env:GITHUB_ENV
111+
env:
112+
vcpkgRelease: '${{ vars.VCPKG_COMMIT_ID }}'
113+
97114
- uses: lukka/run-vcpkg@7d259227a1fb6471a0253dd5ab7419835228f7d7 # v11
98115
with:
99116
runVcpkgInstall: true
100117
vcpkgJsonGlob: '**/build/vcpkg.json'
101-
vcpkgGitCommitId: '${{ vars.VCPKG_COMMIT_ID }}'
118+
vcpkgGitCommitId: '${{ env.VCPKG_COMMIT_ID }}'
102119

103120
- name: 'Configure CMake'
104121
working-directory: ${{ github.workspace }}

0 commit comments

Comments
 (0)