Skip to content

Commit 7e29570

Browse files
committed
ci: disabled saving vcpkg assets cache in case if job running for pull request
1 parent 6dd85b3 commit 7e29570

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

.github/workflows/nightly-builds.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ jobs:
3939
# Enables the vcpkg dependency graph integration.
4040
VCPKG_FEATURE_FLAGS: dependencygraph
4141
steps:
42+
- name: Obtain running job information
43+
uses: qoomon/actions--context@v4
44+
45+
- name: Check for pull request
46+
uses: 8BitJonny/[email protected]
47+
id: pr-check
48+
with:
49+
# Verbose setting SHA when using Pull_Request event trigger to fix #16. (For push even trigger this is not necessary.)
50+
sha: ${{ github.event.pull_request.head.sha }}
51+
4252
- name: Checkout repository
4353
uses: actions/checkout@v4
4454
with:
@@ -75,13 +85,11 @@ jobs:
7585
shell: bash
7686
run: mkdir -p ${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
7787

78-
- name: Obtain running job information
79-
uses: qoomon/actions--context@v4
80-
8188
# Restore vcpkg from the GitHub Action cache service. Note that packages are restored by vcpkg's binary caching
8289
# when it is being run afterwards by CMake.
83-
- name: Caching of vcpkg assets
84-
uses: actions/cache@v4
90+
- name: Restoring cached vcpkg assets
91+
id: vcpkg-cache-restore
92+
uses: actions/cache/restore@v4
8593
with:
8694
# The first path is the location of vcpkg: it contains the vcpkg executable and data files, as long as the
8795
# built package archives (aka binary cache) which are located by VCPKG_DEFAULT_BINARY_CACHE env var.
@@ -130,11 +138,23 @@ jobs:
130138
Compress-Archive -Path publish\* -Destination artifacts\primext-${{ matrix.cmake_preset }}.zip
131139
132140
- name: Upload artifacts
133-
uses: actions/upload-artifact@v4.4.0
141+
uses: actions/upload-artifact@v4
134142
with:
135143
name: artifact-${{ matrix.cmake_preset }}
136144
path: artifacts/*
137145

146+
- name: Saving vcpkg assets to cache
147+
uses: actions/cache/save@v4
148+
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
149+
with:
150+
path: |
151+
${{ env.VCPKG_ROOT }}
152+
!${{ env.VCPKG_ROOT }}/buildtrees
153+
!${{ env.VCPKG_ROOT }}/packages
154+
!${{ env.VCPKG_ROOT }}/downloads
155+
!${{ env.VCPKG_ROOT }}/installed
156+
key: ${{ steps.vcpkg-cache-restore.outputs.cache-primary-key }}
157+
138158
build-android:
139159
runs-on: ubuntu-latest
140160
continue-on-error: true
@@ -176,7 +196,7 @@ jobs:
176196
cp android/app/build/outputs/apk/debug/app-debug.apk artifacts/primext-debug.apk
177197
178198
- name: Upload artifacts
179-
uses: actions/upload-artifact@v4.4.0
199+
uses: actions/upload-artifact@v4
180200
with:
181201
name: artifact-android-debug
182202
path: artifacts/*
@@ -195,7 +215,7 @@ jobs:
195215

196216
- name: Fetch artifacts
197217
if: ${{ always() && github.ref == 'refs/heads/master' && steps.pr-check.outputs.pr_found == 'false' }}
198-
uses: actions/download-artifact@v4.1.7
218+
uses: actions/download-artifact@v4
199219
with:
200220
path: artifacts/
201221

0 commit comments

Comments
 (0)