Skip to content

Commit 483bf6a

Browse files
committed
feat: enhance caching for .NET build and restore processes in content sync workflow
1 parent 5a440c4 commit 483bf6a

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

.github/workflows/content-sync.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,38 @@ jobs:
2727
- uses: actions/setup-dotnet@v4
2828
with:
2929
dotnet-version: '9.0.x'
30+
31+
- name: Cache NuGet packages
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.nuget/packages
35+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/packages.lock.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-nuget-
38+
39+
- name: Cache .NET build outputs
40+
uses: actions/cache@v4
41+
with:
42+
path: |
43+
**/bin
44+
**/obj
45+
key: ${{ runner.os }}-dotnet-build-${{ hashFiles('**/*.csproj', '**/*.cs', '**/Program.cs') }}
46+
restore-keys: |
47+
${{ runner.os }}-dotnet-build-
48+
49+
- name: Restore dependencies
50+
run: dotnet restore ContentLoader/ContentLoader.csproj
3051

3152
- name: Build ContentLoader
32-
run: dotnet build ContentLoader/ContentLoader.csproj --configuration Release
53+
run: dotnet build ContentLoader/ContentLoader.csproj --configuration Release --no-restore
3354

3455
- name: Upload Content
3556
id: upload-content
3657
env:
3758
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.CONTENT_STORAGE_CONNECTION_STRING }}
3859
run: |
3960
# Capture the output from the ContentLoader
40-
output=$(dotnet run --project ContentLoader/ContentLoader.csproj --configuration Release -- Content 2>&1)
61+
output=$(dotnet run --project ContentLoader/ContentLoader.csproj --configuration Release --no-build -- Content 2>&1)
4162
echo "$output" # Extract sync summary numbers using awk for more reliable parsing
4263
added=$(echo "$output" | awk '/Added:/ {print $2}')
4364
updated=$(echo "$output" | awk '/Updated:/ {print $2}')

0 commit comments

Comments
 (0)