|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - main |
7 | | - - release/* |
8 | | - tags: |
9 | | - - "v*" |
10 | | - pull_request: |
11 | | - branches: |
12 | | - - main |
13 | | - - release/* |
14 | | - types: [ opened, synchronize, reopened ] |
15 | 7 |
|
16 | 8 | jobs: |
17 | 9 | # Prime a single LFS cache and expose the exact key for the matrix |
18 | 10 | WarmLFS: |
19 | 11 | runs-on: ubuntu-latest |
| 12 | + permissions: |
| 13 | + contents: read |
20 | 14 | outputs: |
21 | 15 | lfs_key: ${{ steps.expose-key.outputs.lfs_key }} |
22 | 16 | steps: |
|
60 | 54 |
|
61 | 55 | Build: |
62 | 56 | needs: WarmLFS |
| 57 | + permissions: |
| 58 | + contents: read |
63 | 59 | strategy: |
64 | 60 | matrix: |
65 | 61 | options: |
@@ -223,6 +219,9 @@ jobs: |
223 | 219 | token: ${{ secrets.CODECOV_TOKEN }} |
224 | 220 |
|
225 | 221 | Publish: |
| 222 | + permissions: |
| 223 | + id-token: write # Required for OIDC |
| 224 | + contents: read |
226 | 225 | needs: [Build] |
227 | 226 | runs-on: ubuntu-latest |
228 | 227 | if: (github.event_name == 'push') |
@@ -250,19 +249,31 @@ jobs: |
250 | 249 | key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }} |
251 | 250 | restore-keys: ${{ runner.os }}-nuget- |
252 | 251 |
|
253 | | - - name: DotNet Pack |
| 252 | + - name: Compute Version |
| 253 | + id: compute-version |
254 | 254 | shell: pwsh |
255 | | - run: ./ci-pack.ps1 |
| 255 | + run: | |
| 256 | + $date = Get-Date -Format "yyyy.MM.dd" |
| 257 | + $buildNumber = "${{ github.run_number }}" |
| 258 | + $version = "$date-mc.$buildNumber" |
| 259 | + echo "version=$version" >> $env:GITHUB_OUTPUT |
| 260 | + echo "Computed version: $version" |
256 | 261 |
|
257 | | - - name: Feedz Publish |
| 262 | + - name: DotNet Pack |
258 | 263 | shell: pwsh |
259 | | - run: | |
260 | | - dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/nuget/index.json --skip-duplicate |
261 | | - dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/symbols --skip-duplicate |
| 264 | + run: ./ci-pack.ps1 -version "${{ steps.compute-version.outputs.version }}" |
| 265 | + |
| 266 | + - name: Azure Login |
| 267 | + uses: azure/login@v2 |
| 268 | + with: |
| 269 | + client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 270 | + tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 271 | + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 272 | + |
| 273 | + - name: Install Sleet |
| 274 | + run: dotnet tool install -g sleet |
262 | 275 |
|
263 | | - - name: NuGet Publish |
264 | | - if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 276 | + - name: Publish Internal |
265 | 277 | shell: pwsh |
266 | 278 | run: | |
267 | | - dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
268 | | - dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate |
| 279 | + sleet push ./artifacts --config sleet.json artifacts |
0 commit comments