|
11 | 11 | branches: |
12 | 12 | - main |
13 | 13 | - release/* |
14 | | - types: [ labeled, opened, synchronize, reopened ] |
| 14 | + types: [ opened, synchronize, reopened ] |
15 | 15 | jobs: |
| 16 | + # Prime a single LFS cache and expose the exact key for the matrix |
| 17 | + WarmLFS: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + outputs: |
| 20 | + lfs_key: ${{ steps.expose-key.outputs.lfs_key }} |
| 21 | + steps: |
| 22 | + - name: Git Config |
| 23 | + shell: bash |
| 24 | + run: | |
| 25 | + git config --global core.autocrlf false |
| 26 | + git config --global core.longpaths true |
| 27 | +
|
| 28 | + - name: Git Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + submodules: recursive |
| 33 | + |
| 34 | + # Deterministic list of LFS object IDs, then compute a portable key: |
| 35 | + # - `git lfs ls-files -l` lists all tracked LFS objects with their SHA-256 |
| 36 | + # - `awk '{print $1}'` extracts just the SHA field |
| 37 | + # - `sort` sorts in byte order (hex hashes sort the same everywhere) |
| 38 | + # This ensures the file content is identical regardless of OS or locale |
| 39 | + - name: Git Create LFS id list |
| 40 | + shell: bash |
| 41 | + run: git lfs ls-files -l | awk '{print $1}' | sort > .lfs-assets-id |
| 42 | + |
| 43 | + - name: Git Expose LFS cache key |
| 44 | + id: expose-key |
| 45 | + shell: bash |
| 46 | + env: |
| 47 | + LFS_KEY: lfs-${{ hashFiles('.lfs-assets-id') }}-v1 |
| 48 | + run: echo "lfs_key=$LFS_KEY" >> "$GITHUB_OUTPUT" |
| 49 | + |
| 50 | + - name: Git Setup LFS Cache |
| 51 | + uses: actions/cache@v4 |
| 52 | + with: |
| 53 | + path: .git/lfs |
| 54 | + key: ${{ steps.expose-key.outputs.lfs_key }} |
| 55 | + |
| 56 | + - name: Git Pull LFS |
| 57 | + shell: bash |
| 58 | + run: git lfs pull |
| 59 | + |
16 | 60 | Build: |
| 61 | + needs: WarmLFS |
17 | 62 | strategy: |
18 | 63 | matrix: |
19 | 64 | options: |
@@ -67,16 +112,12 @@ jobs: |
67 | 112 | fetch-depth: 0 |
68 | 113 | submodules: recursive |
69 | 114 |
|
70 | | - # See https://github.com/actions/checkout/issues/165#issuecomment-657673315 |
71 | | - - name: Git Create LFS FileList |
72 | | - run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id |
73 | | - |
| 115 | + # Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here. |
74 | 116 | - name: Git Setup LFS Cache |
75 | 117 | uses: actions/cache@v4 |
76 | | - id: lfs-cache |
77 | 118 | with: |
78 | 119 | path: .git/lfs |
79 | | - key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}-v1 |
| 120 | + key: ${{ needs.WarmLFS.outputs.lfs_key }} |
80 | 121 |
|
81 | 122 | - name: Git Pull LFS |
82 | 123 | run: git lfs pull |
@@ -136,51 +177,50 @@ jobs: |
136 | 177 | SIXLABORS_TESTING_PREVIEW: True |
137 | 178 | XUNIT_PATH: .\tests\PolygonClipper.Tests # Required for xunit |
138 | 179 |
|
139 | | - # Publish: |
140 | | - # needs: [Build] |
141 | | - |
142 | | - # runs-on: ubuntu-latest |
143 | | - |
144 | | - # if: (github.event_name == 'push') |
145 | | - |
146 | | - # steps: |
147 | | - # - name: Git Config |
148 | | - # shell: bash |
149 | | - # run: | |
150 | | - # git config --global core.autocrlf false |
151 | | - # git config --global core.longpaths true |
152 | | - |
153 | | - # - name: Git Checkout |
154 | | - # uses: actions/checkout@v4 |
155 | | - # with: |
156 | | - # fetch-depth: 0 |
157 | | - # submodules: recursive |
158 | | - |
159 | | - # - name: NuGet Install |
160 | | - # uses: NuGet/setup-nuget@v2 |
161 | | - |
162 | | - # - name: NuGet Setup Cache |
163 | | - # uses: actions/cache@v4 |
164 | | - # id: nuget-cache |
165 | | - # with: |
166 | | - # path: ~/.nuget |
167 | | - # key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }} |
168 | | - # restore-keys: ${{ runner.os }}-nuget- |
169 | | - |
170 | | - # - name: DotNet Pack |
171 | | - # shell: pwsh |
172 | | - # run: ./ci-pack.ps1 |
173 | | - |
174 | | - # - name: Feedz Publish |
175 | | - # shell: pwsh |
176 | | - # run: | |
177 | | - # dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/nuget/index.json --skip-duplicate |
178 | | - # dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/symbols --skip-duplicate |
179 | | - |
180 | | - # - name: NuGet Publish |
181 | | - # if: ${{ startsWith(github.ref, 'refs/tags/') }} |
182 | | - # shell: pwsh |
183 | | - # run: | |
184 | | - # dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
185 | | - # dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
| 180 | + Publish: |
| 181 | + needs: [Build] |
| 182 | + |
| 183 | + runs-on: ubuntu-latest |
| 184 | + |
| 185 | + if: (github.event_name == 'push') |
| 186 | + |
| 187 | + steps: |
| 188 | + - name: Git Config |
| 189 | + shell: bash |
| 190 | + run: | |
| 191 | + git config --global core.autocrlf false |
| 192 | + git config --global core.longpaths true |
| 193 | +
|
| 194 | + - name: Git Checkout |
| 195 | + uses: actions/checkout@v4 |
| 196 | + with: |
| 197 | + fetch-depth: 0 |
| 198 | + submodules: recursive |
| 199 | + |
| 200 | + - name: NuGet Install |
| 201 | + uses: NuGet/setup-nuget@v2 |
186 | 202 |
|
| 203 | + - name: NuGet Setup Cache |
| 204 | + uses: actions/cache@v4 |
| 205 | + id: nuget-cache |
| 206 | + with: |
| 207 | + path: ~/.nuget |
| 208 | + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }} |
| 209 | + restore-keys: ${{ runner.os }}-nuget- |
| 210 | + |
| 211 | + - name: DotNet Pack |
| 212 | + shell: pwsh |
| 213 | + run: ./ci-pack.ps1 |
| 214 | + |
| 215 | + - name: Feedz Publish |
| 216 | + shell: pwsh |
| 217 | + run: | |
| 218 | + dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/nuget/index.json --skip-duplicate |
| 219 | + dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/symbols --skip-duplicate |
| 220 | +
|
| 221 | + - name: NuGet Publish |
| 222 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 223 | + shell: pwsh |
| 224 | + run: | |
| 225 | + dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
| 226 | + dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
0 commit comments