Skip to content

Commit dd4ca16

Browse files
jlskuzddennedy
authored andcommitted
Use NuGet to cache vcpkg packages in GitHub Actions
See https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-packages Related to #1189
1 parent 0af529c commit dd4ca16

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/build-windows-msvc.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ name: build-test-windows-msvc-on-push
22

33
on: [push, pull_request]
44

5+
permissions:
6+
packages: write
7+
58
jobs:
69
build-cmake-msvc:
710
runs-on: windows-latest
11+
env:
12+
VCPKG_BINARY_SOURCES: "clear;nuget,https://nuget.pkg.github.com/mltframework/index.json,readwrite"
813
steps:
914
- uses: actions/checkout@v4
1015

@@ -13,6 +18,24 @@ jobs:
1318
with:
1419
vcpkgJsonGlob: 'vcpkg.json'
1520

21+
- name: Add NuGet sources
22+
shell: pwsh
23+
env:
24+
USERNAME: mltframework
25+
VCPKG_EXE: ${{ env.VCPKG_ROOT }}/vcpkg
26+
FEED_URL: https://nuget.pkg.github.com/mltframework/index.json
27+
run: |
28+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
29+
sources add `
30+
-Source "${{ env.FEED_URL }}" `
31+
-StorePasswordInClearText `
32+
-Name GitHubPackages `
33+
-UserName "${{ env.USERNAME }}" `
34+
-Password "${{ secrets.GITHUB_TOKEN }}"
35+
.$(${{ env.VCPKG_EXE }} fetch nuget) `
36+
setapikey "${{ secrets.GITHUB_TOKEN }}" `
37+
-Source "${{ env.FEED_URL }}"
38+
1639
- name: Setup MSVC
1740
uses: ilammy/msvc-dev-cmd@v1
1841

0 commit comments

Comments
 (0)