12
12
- main
13
13
- release/*
14
14
types : [ labeled, opened, synchronize, reopened ]
15
+
15
16
jobs :
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
+
16
61
Build :
62
+ needs : WarmLFS
17
63
strategy :
18
64
matrix :
19
65
isARM :
@@ -69,14 +115,14 @@ jobs:
69
115
options :
70
116
os : buildjet-4vcpu-ubuntu-2204-arm
71
117
72
- runs-on : ${{matrix.options.os}}
118
+ runs-on : ${{ matrix.options.os }}
73
119
74
120
steps :
75
121
- name : Install libgdi+, which is required for tests running on ubuntu
76
122
if : ${{ contains(matrix.options.os, 'ubuntu') }}
77
123
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
80
126
81
127
- name : Git Config
82
128
shell : bash
@@ -90,18 +136,15 @@ jobs:
90
136
fetch-depth : 0
91
137
submodules : recursive
92
138
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.
97
140
- name : Git Setup LFS Cache
98
141
uses : actions/cache@v4
99
- id : lfs-cache
100
142
with :
101
143
path : .git/lfs
102
- key : ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1
144
+ key : ${{ needs.WarmLFS.outputs.lfs_key }}
103
145
104
146
- name : Git Pull LFS
147
+ shell : bash
105
148
run : git lfs pull
106
149
107
150
- name : NuGet Install
@@ -168,11 +211,8 @@ jobs:
168
211
169
212
Publish :
170
213
needs : [Build]
171
-
172
214
runs-on : ubuntu-latest
173
-
174
215
if : (github.event_name == 'push')
175
-
176
216
steps :
177
217
- name : Git Config
178
218
shell : bash
@@ -213,4 +253,3 @@ jobs:
213
253
run : |
214
254
dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
215
255
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
216
-
0 commit comments