Skip to content

Commit 276fce9

Browse files
authored
Save cache at end of vcpkg-action instead of end of the job (#56)
* Save cache at end of vcpkg-action instead of end of the job * Don't save if cache hit
1 parent c1f2590 commit 276fce9

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

action.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ runs:
135135
"${{ github.workspace }}/${{ inputs.vcpkg-subdir }}/vcpkg" install --dry-run --triplet ${{ inputs.triplet }} ${{ inputs.extra-args }} --x-manifest-root=${{ inputs.manifest-dir }} --x-install-root=${{ github.workspace }}/${{ inputs.vcpkg-subdir }}/installed --x-write-nuget-packages-config=vcpkg_dry_run.txt
136136
env:
137137
VCPKG_ROOT: "${{ github.workspace }}/${{ inputs.vcpkg-subdir }}"
138-
- name: cache-vcpkg-archives
139-
if: ${{ inputs.disable_cache != 'true' }}
140-
id: cache-vcpkg-archives
141-
uses: actions/cache@v5
138+
- name: cache-vcpkg-archives-restore
139+
if: ${{ inputs.disable-cache != 'true' }}
140+
id: cache-vcpkg-archives-restore
141+
uses: actions/cache/restore@v5
142142
with:
143143
path: ${{ runner.temp }}/vcpkg_cache
144144
key: ${{ runner.os }}-${{ inputs.triplet }}-vcpkg-${{ hashFiles(format('{0}/vcpkg_dry_run.txt',inputs.vcpkg-subdir)) }}-${{ inputs.cache-key }}
@@ -189,3 +189,12 @@ runs:
189189
name: vcpkg-logs-${{ runner.os }}-${{ inputs.triplet }}-vcpkg-${{ hashFiles(format('{0}/vcpkg_dry_run.txt',inputs.vcpkg-subdir)) }}-${{ inputs.cache-key }}
190190
path: "${{ inputs.vcpkg-subdir }}/**/*.log"
191191
retention-days: 7
192+
- name: cache-vcpkg-archives-save
193+
if: ${{ inputs.disable-cache != 'true' && success() && steps.cache-vcpkg-archives-restore.outputs.cache-hit != 'true'}}
194+
id: cache-vcpkg-archives-save
195+
uses: actions/cache/save@v5
196+
with:
197+
path: ${{ runner.temp }}/vcpkg_cache
198+
key: ${{ runner.os }}-${{ inputs.triplet }}-vcpkg-${{ hashFiles(format('{0}/vcpkg_dry_run.txt',inputs.vcpkg-subdir)) }}-${{ inputs.cache-key }}
199+
env:
200+
VCPKG_ROOT: "${{ github.workspace }}/${{ inputs.vcpkg-subdir }}"

0 commit comments

Comments
 (0)