Skip to content

Commit 9445169

Browse files
committed
Update ci to publish internal package
1 parent 0774da7 commit 9445169

7 files changed

Lines changed: 67 additions & 26 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@ on:
44
push:
55
branches:
66
- main
7-
- release/*
8-
tags:
9-
- "v*"
10-
pull_request:
11-
branches:
12-
- main
13-
- release/*
14-
types: [ labeled, opened, synchronize, reopened ]
157

168
jobs:
179
# Prime a single LFS cache and expose the exact key for the matrix
1810
WarmLFS:
1911
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
2014
outputs:
2115
lfs_key: ${{ steps.expose-key.outputs.lfs_key }}
2216
steps:
@@ -60,6 +54,8 @@ jobs:
6054

6155
Build:
6256
needs: WarmLFS
57+
permissions:
58+
contents: read
6359
strategy:
6460
matrix:
6561
isARM:
@@ -216,6 +212,9 @@ jobs:
216212
flags: unittests
217213

218214
Publish:
215+
permissions:
216+
id-token: write # Required for OIDC
217+
contents: read
219218
needs: [Build]
220219
runs-on: ubuntu-latest
221220
if: (github.event_name == 'push')
@@ -243,19 +242,31 @@ jobs:
243242
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
244243
restore-keys: ${{ runner.os }}-nuget-
245244

246-
- name: DotNet Pack
245+
- name: Compute Version
246+
id: compute-version
247247
shell: pwsh
248-
run: ./ci-pack.ps1
248+
run: |
249+
$date = Get-Date -Format "yyyy.MM.dd"
250+
$buildNumber = "${{ github.run_number }}"
251+
$version = "$date-mc.$buildNumber"
252+
echo "version=$version" >> $env:GITHUB_OUTPUT
253+
echo "Computed version: $version"
249254
250-
- name: Feedz Publish
255+
- name: DotNet Pack
251256
shell: pwsh
252-
run: |
253-
dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/nuget/index.json --skip-duplicate
254-
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/symbols --skip-duplicate
257+
run: ./ci-pack.ps1 -version "${{ steps.compute-version.outputs.version }}"
258+
259+
- name: Azure Login
260+
uses: azure/login@v2
261+
with:
262+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
263+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
264+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
265+
266+
- name: Install Sleet
267+
run: dotnet tool install -g sleet
255268

256-
- name: NuGet Publish
257-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
269+
- name: Publish Internal
258270
shell: pwsh
259271
run: |
260-
dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
261-
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
272+
sleet push ./artifacts --config sleet.json artifacts

Directory.Build.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
<SixLaborsSolutionDirectory>$(MSBuildThisFileDirectory)</SixLaborsSolutionDirectory>
1616
</PropertyGroup>
1717

18+
<PropertyGroup>
19+
<RestoreSources>
20+
$(RestoreSources);
21+
https://mcpublicnugetstouse.blob.core.windows.net/imagesharp/index.json
22+
</RestoreSources>
23+
</PropertyGroup>
24+
1825
<!-- Import the shared global .props file -->
1926
<Import Project="$(MSBuildThisFileDirectory)shared-infrastructure\msbuild\props\SixLabors.Global.props" />
2027

ci-pack.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
param(
2+
[Parameter(Mandatory = $true, Position = 0)]
3+
[string]$Version
4+
)
5+
16
dotnet clean -c Release
27

38
$repositoryUrl = "https://github.com/$env:GITHUB_REPOSITORY"
49

510
# Building for packing and publishing.
6-
dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:RepositoryUrl=$repositoryUrl
11+
dotnet pack -c Release --output "$PSScriptRoot/artifacts" /p:RepositoryUrl=$repositoryUrl -p:MinVerVersionOverride=$Version
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
4-
<add key="myget.org sixlabors-CI" value="https://www.myget.org/F/sixlabors/api/v3/index.json" />
4+
<add key="mediaclip-imagesharp" value="https://mcpublicnugetstouse.blob.core.windows.net/imagesharp/index.json" />
55
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
66
<add key="nuget.org" value="https://www.nuget.org/api/v2/" />
77
</packageSources>
8-
</configuration>
8+
</configuration>

sleet.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"username": "",
3+
"useremail": "",
4+
"sources": [
5+
{
6+
"name": "ImageSharp",
7+
"type": "azure",
8+
"container": "imagesharp",
9+
"path": "https://mcpublicnugetstouse.blob.core.windows.net/imagesharp/"
10+
}
11+
]
12+
}

src/ImageSharp.Drawing/ImageSharp.Drawing.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<Nullable>enable</Nullable>
2626
<WarningsAsErrors>Nullable</WarningsAsErrors>
2727
</PropertyGroup>
28-
28+
2929
<Choose>
3030
<When Condition="$(SIXLABORS_TESTING_PREVIEW) == true">
3131
<PropertyGroup>
@@ -38,14 +38,14 @@
3838
</PropertyGroup>
3939
</Otherwise>
4040
</Choose>
41-
41+
4242
<ItemGroup>
4343
<None Include="..\..\LICENSE" Pack="true" PackagePath="" />
4444
<None Include="..\..\shared-infrastructure\branding\icons\imagesharp.drawing\sixlabors.imagesharp.drawing.128.png" Pack="true" PackagePath="" />
4545
</ItemGroup>
4646
<ItemGroup>
47-
<PackageReference Include="SixLabors.Fonts" Version="3.0.0-alpha.0.3" />
48-
<PackageReference Include="SixLabors.ImageSharp" Version="4.0.0-alpha.0.49" />
47+
<PackageReference Include="SixLabors.Fonts" Version="2025.12.15-mc.1" />
48+
<PackageReference Include="SixLabors.ImageSharp" Version="2025.12.15-mc.1" />
4949
</ItemGroup>
5050
<Import Project="..\..\shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems" Label="Shared" />
51-
</Project>
51+
</Project>

tests/Directory.Build.props

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@
2020
<UseImageSharp>true</UseImageSharp>
2121
</PropertyGroup>
2222

23+
<PropertyGroup>
24+
<RestoreSources>
25+
$(RestoreSources);
26+
https://mcpublicnugetstouse.blob.core.windows.net/imagesharp/index.json
27+
</RestoreSources>
28+
</PropertyGroup>
2329
</Project>

0 commit comments

Comments
 (0)