1212 - main
1313 - release/*
1414 types : [ labeled, opened, synchronize, reopened ]
15+
1516jobs :
17+ # Prime a single LFS cache and expose the exact key for the matrix
18+ WarmLFS :
19+ runs-on : ubuntu-latest
20+ outputs :
21+ lfs_key : ${{ steps.expose-key.outputs.lfs_key }}
22+ steps :
23+ - name : Git Config
24+ shell : bash
25+ run : |
26+ git config --global core.autocrlf false
27+ git config --global core.longpaths true
28+
29+ - name : Git Checkout
30+ uses : actions/checkout@v4
31+ with :
32+ fetch-depth : 0
33+ submodules : recursive
34+
35+ # Deterministic list of LFS object IDs, then compute a portable key:
36+ # - `git lfs ls-files -l` lists all tracked LFS objects with their SHA-256
37+ # - `awk '{print $1}'` extracts just the SHA field
38+ # - `sort` sorts in byte order (hex hashes sort the same everywhere)
39+ # This ensures the file content is identical regardless of OS or locale
40+ - name : Git Create LFS id list
41+ shell : bash
42+ run : git lfs ls-files -l | awk '{print $1}' | sort > .lfs-assets-id
43+
44+ - name : Git Expose LFS cache key
45+ id : expose-key
46+ shell : bash
47+ env :
48+ LFS_KEY : lfs-${{ hashFiles('.lfs-assets-id') }}-v1
49+ run : echo "lfs_key=$LFS_KEY" >> "$GITHUB_OUTPUT"
50+
51+ - name : Git Setup LFS Cache
52+ uses : actions/cache@v4
53+ with :
54+ path : .git/lfs
55+ key : ${{ steps.expose-key.outputs.lfs_key }}
56+
57+ - name : Git Pull LFS
58+ shell : bash
59+ run : git lfs pull
60+
1661 Build :
62+ needs : WarmLFS
1763 strategy :
1864 matrix :
1965 isARM :
@@ -69,14 +115,14 @@ jobs:
69115 options :
70116 os : buildjet-4vcpu-ubuntu-2204-arm
71117
72- runs-on : ${{matrix.options.os}}
118+ runs-on : ${{ matrix.options.os }}
73119
74120 steps :
75121 - name : Install libgdi+, which is required for tests running on ubuntu
76122 if : ${{ contains(matrix.options.os, 'ubuntu') }}
77123 run : |
78- sudo apt-get update
79- sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev
124+ sudo apt-get update
125+ sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev
80126
81127 - name : Git Config
82128 shell : bash
@@ -90,18 +136,15 @@ jobs:
90136 fetch-depth : 0
91137 submodules : recursive
92138
93- # See https://github.com/actions/checkout/issues/165#issuecomment-657673315
94- - name : Git Create LFS FileList
95- run : git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
96-
139+ # Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here.
97140 - name : Git Setup LFS Cache
98141 uses : actions/cache@v4
99- id : lfs-cache
100142 with :
101143 path : .git/lfs
102- key : ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
144+ key : ${{ needs.WarmLFS.outputs.lfs_key }}
103145
104146 - name : Git Pull LFS
147+ shell : bash
105148 run : git lfs pull
106149
107150 - name : NuGet Install
@@ -168,11 +211,8 @@ jobs:
168211
169212 Publish :
170213 needs : [Build]
171-
172214 runs-on : ubuntu-latest
173-
174215 if : (github.event_name == 'push')
175-
176216 steps :
177217 - name : Git Config
178218 shell : bash
@@ -213,4 +253,3 @@ jobs:
213253 run : |
214254 dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
215255 dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
216-
0 commit comments