Skip to content

Commit

Permalink
Merge pull request #1177 from lairworks/vcpkgGitHubActionsCache
Browse files Browse the repository at this point in the history
Use `vcpkg` GitHub Actions Cache support
  • Loading branch information
DanRStevens authored Nov 27, 2024
2 parents 7b26ea9 + b85e7e3 commit ae0b1f4
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,27 @@ jobs:
PLATFORM: ${{ matrix.platform }}
BUILD_CONFIGURATION: Release
SOLUTION_FILE_PATH: .
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'

steps:
- uses: actions/checkout@v4

- name: Add MSBuild to PATH
uses: microsoft/[email protected]

- name: Setup NuGet credentials
shell: bash
run: |
$(vcpkg fetch nuget | tail -n1) \
sources add \
-source "https://nuget.pkg.github.com/lairworks/index.json" \
-storepasswordincleartext \
-name "GitHub" \
-username "lairworks" \
-password "${{ secrets.GITHUB_TOKEN }}"
$(vcpkg fetch nuget | tail -n1) \
setApiKey "${{ secrets.GITHUB_TOKEN }}" \
-source "https://nuget.pkg.github.com/lairworks/index.json"
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Restore vcpkg dependency cache
uses: actions/cache@v4
id: cache
with:
path: vcpkg_installed
key: ${{ runner.os }}-${{ matrix.platform }}-${{ hashFiles('vcpkg.json') }}
key: vcpkgCache-${{ runner.os }}-${{ matrix.platform }}-${{ hashFiles('vcpkg.json') }}

- name: Restore incremental build cache
uses: actions/cache/restore@v4
Expand Down

0 comments on commit ae0b1f4

Please sign in to comment.