Skip to content

Commit

Permalink
Update VCPKG GHAs to use head if variable isn't set (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn authored Jan 31, 2025
1 parent c130e57 commit 5ec3483
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,28 @@ jobs:
echo "::error Unknown architecture/build-type triplet mapping"
}
- name: Get vcpkg commit hash
shell: pwsh
run: |
if ($Env:vcpkgRelease) {
echo "Using vcpkg commit from repo variable..."
$VCPKG_COMMIT_ID = $Env:vcpkgRelease
}
else {
echo "Fetching latest vcpkg commit hash..."
$commit = (git ls-remote https://github.com/microsoft/vcpkg.git HEAD | Select-String -Pattern '([a-f0-9]{40})').Matches.Value
$VCPKG_COMMIT_ID = $commit
}
Write-Host "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID"
echo "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID" >> $env:GITHUB_ENV
env:
vcpkgRelease: '${{ vars.VCPKG_COMMIT_ID }}'

- uses: lukka/run-vcpkg@7d259227a1fb6471a0253dd5ab7419835228f7d7 # v11
with:
runVcpkgInstall: true
vcpkgJsonGlob: '**/build/vcpkg.json'
vcpkgGitCommitId: '${{ vars.VCPKG_COMMIT_ID }}'
vcpkgGitCommitId: '${{ env.VCPKG_COMMIT_ID }}'

- name: 'Instance templates'
shell: pwsh
Expand Down
19 changes: 18 additions & 1 deletion .github/workflows/vcpkguwp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,28 @@ jobs:
echo "::error Unknown architecture/build-type triplet mapping"
}
- name: Get vcpkg commit hash
shell: pwsh
run: |
if ($Env:vcpkgRelease) {
echo "Using vcpkg commit from repo variable..."
$VCPKG_COMMIT_ID = $Env:vcpkgRelease
}
else {
echo "Fetching latest vcpkg commit hash..."
$commit = (git ls-remote https://github.com/microsoft/vcpkg.git HEAD | Select-String -Pattern '([a-f0-9]{40})').Matches.Value
$VCPKG_COMMIT_ID = $commit
}
Write-Host "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID"
echo "VCPKG_COMMIT_ID=$VCPKG_COMMIT_ID" >> $env:GITHUB_ENV
env:
vcpkgRelease: '${{ vars.VCPKG_COMMIT_ID }}'

- uses: lukka/run-vcpkg@7d259227a1fb6471a0253dd5ab7419835228f7d7 # v11
with:
runVcpkgInstall: true
vcpkgJsonGlob: '**/build/vcpkg.json'
vcpkgGitCommitId: '${{ vars.VCPKG_COMMIT_ID }}'
vcpkgGitCommitId: '${{ env.VCPKG_COMMIT_ID }}'

- name: 'Instance templates'
shell: pwsh
Expand Down

0 comments on commit 5ec3483

Please sign in to comment.