Skip to content

Commit 2c37715

Browse files
committed
Publish custom version to custom feed
1 parent 1b6108a commit 2c37715

File tree

3 files changed

+201
-175
lines changed

3 files changed

+201
-175
lines changed

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

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

1610
jobs:
1711
# Prime a single LFS cache and expose the exact key for the matrix
@@ -57,79 +51,172 @@ jobs:
5751
- name: Git Pull LFS
5852
shell: bash
5953
run: git lfs pull
54+
#
55+
# Build:
56+
# needs: WarmLFS
57+
# strategy:
58+
# matrix:
59+
# options:
60+
# - os: ubuntu-latest
61+
# framework: net10.0
62+
# sdk: 10.0.x
63+
# sdk-preview: true
64+
# runtime: -x64
65+
# codecov: false
66+
# - os: macos-26
67+
# framework: net10.0
68+
# sdk: 10.0.x
69+
# sdk-preview: true
70+
# runtime: -x64
71+
# codecov: false
72+
# - os: windows-latest
73+
# framework: net10.0
74+
# sdk: 10.0.x
75+
# sdk-preview: true
76+
# runtime: -x64
77+
# codecov: false
78+
# - os: ubuntu-22.04-arm
79+
# framework: net10.0
80+
# sdk: 10.0.x
81+
# sdk-preview: true
82+
# runtime: -x64
83+
# codecov: false
84+
#
85+
# - os: ubuntu-latest
86+
# framework: net8.0
87+
# sdk: 8.0.x
88+
# runtime: -x64
89+
# codecov: false
90+
# - os: macos-26
91+
# framework: net8.0
92+
# sdk: 8.0.x
93+
# runtime: -x64
94+
# codecov: false
95+
# - os: windows-latest
96+
# framework: net8.0
97+
# sdk: 8.0.x
98+
# runtime: -x64
99+
# codecov: false
100+
# - os: ubuntu-22.04-arm
101+
# framework: net8.0
102+
# sdk: 8.0.x
103+
# runtime: -x64
104+
# codecov: false
105+
#
106+
# runs-on: ${{ matrix.options.os }}
107+
#
108+
# steps:
109+
# - name: Install libgdi+, which is required for tests running on ubuntu
110+
# if: ${{ contains(matrix.options.os, 'ubuntu') }}
111+
# run: |
112+
# sudo apt-get update
113+
# sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev
114+
#
115+
# - name: Install libgdi+, which is required for tests running on macos
116+
# if: ${{ contains(matrix.options.os, 'macos-26') }}
117+
# run: |
118+
# brew update
119+
# brew install mono-libgdiplus
120+
# # Create symlinks to make libgdiplus discoverable
121+
# sudo mkdir -p /usr/local/lib
122+
# sudo ln -sf $(brew --prefix)/lib/libgdiplus.dylib /usr/local/lib/libgdiplus.dylib
123+
# # Verify installation
124+
# ls -la $(brew --prefix)/lib/libgdiplus* || echo "libgdiplus not found in brew prefix"
125+
# ls -la /usr/local/lib/libgdiplus* || echo "libgdiplus not found in /usr/local/lib"
126+
#
127+
# - name: Git Config
128+
# shell: bash
129+
# run: |
130+
# git config --global core.autocrlf false
131+
# git config --global core.longpaths true
132+
#
133+
# - name: Git Checkout
134+
# uses: actions/checkout@v4
135+
# with:
136+
# fetch-depth: 0
137+
# submodules: recursive
138+
#
139+
# # Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here.
140+
# - name: Git Setup LFS Cache
141+
# uses: actions/cache@v4
142+
# with:
143+
# path: .git/lfs
144+
# key: ${{ needs.WarmLFS.outputs.lfs_key }}
145+
#
146+
# - name: Git Pull LFS
147+
# shell: bash
148+
# run: git lfs pull
149+
#
150+
# - name: NuGet Install
151+
# uses: NuGet/setup-nuget@v2
152+
#
153+
# - name: NuGet Setup Cache
154+
# uses: actions/cache@v4
155+
# id: nuget-cache
156+
# with:
157+
# path: ~/.nuget
158+
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
159+
# restore-keys: ${{ runner.os }}-nuget-
160+
#
161+
# - name: DotNet Setup
162+
# if: ${{ matrix.options.sdk-preview != true }}
163+
# uses: actions/setup-dotnet@v4
164+
# with:
165+
# dotnet-version: |
166+
# 8.0.x
167+
#
168+
# - name: DotNet Setup Preview
169+
# if: ${{ matrix.options.sdk-preview == true }}
170+
# uses: actions/setup-dotnet@v4
171+
# with:
172+
# dotnet-version: |
173+
# 10.0.x
174+
#
175+
# - name: DotNet Build
176+
# if: ${{ matrix.options.sdk-preview != true }}
177+
# shell: pwsh
178+
# run: ./ci-build.ps1 "${{matrix.options.framework}}"
179+
# env:
180+
# SIXLABORS_TESTING: True
181+
#
182+
# - name: DotNet Build Preview
183+
# if: ${{ matrix.options.sdk-preview == true }}
184+
# shell: pwsh
185+
# run: ./ci-build.ps1 "${{matrix.options.framework}}"
186+
# env:
187+
# SIXLABORS_TESTING_PREVIEW: True
188+
#
189+
# - name: DotNet Test
190+
# if: ${{ matrix.options.sdk-preview != true }}
191+
# shell: pwsh
192+
# run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
193+
# env:
194+
# SIXLABORS_TESTING: True
195+
# XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
196+
#
197+
# - name: DotNet Test Preview
198+
# if: ${{ matrix.options.sdk-preview == true }}
199+
# shell: pwsh
200+
# run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
201+
# env:
202+
# SIXLABORS_TESTING_PREVIEW: True
203+
# XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
204+
#
205+
# - name: Export Failed Output
206+
# uses: actions/upload-artifact@v4
207+
# if: failure()
208+
# with:
209+
# name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
210+
# path: tests/Images/ActualOutput/
60211

61-
Build:
62-
needs: WarmLFS
63-
strategy:
64-
matrix:
65-
options:
66-
- os: ubuntu-latest
67-
framework: net10.0
68-
sdk: 10.0.x
69-
sdk-preview: true
70-
runtime: -x64
71-
codecov: false
72-
- os: macos-26
73-
framework: net10.0
74-
sdk: 10.0.x
75-
sdk-preview: true
76-
runtime: -x64
77-
codecov: false
78-
- os: windows-latest
79-
framework: net10.0
80-
sdk: 10.0.x
81-
sdk-preview: true
82-
runtime: -x64
83-
codecov: false
84-
- os: ubuntu-22.04-arm
85-
framework: net10.0
86-
sdk: 10.0.x
87-
sdk-preview: true
88-
runtime: -x64
89-
codecov: false
90-
91-
- os: ubuntu-latest
92-
framework: net8.0
93-
sdk: 8.0.x
94-
runtime: -x64
95-
codecov: false
96-
- os: macos-26
97-
framework: net8.0
98-
sdk: 8.0.x
99-
runtime: -x64
100-
codecov: false
101-
- os: windows-latest
102-
framework: net8.0
103-
sdk: 8.0.x
104-
runtime: -x64
105-
codecov: false
106-
- os: ubuntu-22.04-arm
107-
framework: net8.0
108-
sdk: 8.0.x
109-
runtime: -x64
110-
codecov: false
111-
112-
runs-on: ${{ matrix.options.os }}
113-
212+
Publish:
213+
permissions:
214+
id-token: write # Required for OIDC
215+
contents: read
216+
# needs: [Build]
217+
runs-on: ubuntu-latest
218+
if: (github.event_name == 'push')
114219
steps:
115-
- name: Install libgdi+, which is required for tests running on ubuntu
116-
if: ${{ contains(matrix.options.os, 'ubuntu') }}
117-
run: |
118-
sudo apt-get update
119-
sudo apt-get -y install libgdiplus libgif-dev libglib2.0-dev libcairo2-dev libtiff-dev libexif-dev
120-
121-
- name: Install libgdi+, which is required for tests running on macos
122-
if: ${{ contains(matrix.options.os, 'macos-26') }}
123-
run: |
124-
brew update
125-
brew install mono-libgdiplus
126-
# Create symlinks to make libgdiplus discoverable
127-
sudo mkdir -p /usr/local/lib
128-
sudo ln -sf $(brew --prefix)/lib/libgdiplus.dylib /usr/local/lib/libgdiplus.dylib
129-
# Verify installation
130-
ls -la $(brew --prefix)/lib/libgdiplus* || echo "libgdiplus not found in brew prefix"
131-
ls -la /usr/local/lib/libgdiplus* || echo "libgdiplus not found in /usr/local/lib"
132-
133220
- name: Git Config
134221
shell: bash
135222
run: |
@@ -142,17 +229,6 @@ jobs:
142229
fetch-depth: 0
143230
submodules: recursive
144231

145-
# Use the warmed key from WarmLFS. Do not recompute or recreate .lfs-assets-id here.
146-
- name: Git Setup LFS Cache
147-
uses: actions/cache@v4
148-
with:
149-
path: .git/lfs
150-
key: ${{ needs.WarmLFS.outputs.lfs_key }}
151-
152-
- name: Git Pull LFS
153-
shell: bash
154-
run: git lfs pull
155-
156232
- name: NuGet Install
157233
uses: NuGet/setup-nuget@v2
158234

@@ -164,98 +240,31 @@ jobs:
164240
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
165241
restore-keys: ${{ runner.os }}-nuget-
166242

167-
- name: DotNet Setup
168-
if: ${{ matrix.options.sdk-preview != true }}
169-
uses: actions/setup-dotnet@v4
170-
with:
171-
dotnet-version: |
172-
8.0.x
173-
174-
- name: DotNet Setup Preview
175-
if: ${{ matrix.options.sdk-preview == true }}
176-
uses: actions/setup-dotnet@v4
177-
with:
178-
dotnet-version: |
179-
10.0.x
180-
181-
- name: DotNet Build
182-
if: ${{ matrix.options.sdk-preview != true }}
183-
shell: pwsh
184-
run: ./ci-build.ps1 "${{matrix.options.framework}}"
185-
env:
186-
SIXLABORS_TESTING: True
187-
188-
- name: DotNet Build Preview
189-
if: ${{ matrix.options.sdk-preview == true }}
190-
shell: pwsh
191-
run: ./ci-build.ps1 "${{matrix.options.framework}}"
192-
env:
193-
SIXLABORS_TESTING_PREVIEW: True
194-
195-
- name: DotNet Test
196-
if: ${{ matrix.options.sdk-preview != true }}
197-
shell: pwsh
198-
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
199-
env:
200-
SIXLABORS_TESTING: True
201-
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
243+
- name: Install Sleet
244+
run: dotnet tool install -g sleet
202245

203-
- name: DotNet Test Preview
204-
if: ${{ matrix.options.sdk-preview == true }}
246+
- name: Compute Version
247+
id: compute-version
205248
shell: pwsh
206-
run: ./ci-test.ps1 "${{matrix.options.os}}" "${{matrix.options.framework}}" "${{matrix.options.runtime}}" "${{matrix.options.codecov}}"
207-
env:
208-
SIXLABORS_TESTING_PREVIEW: True
209-
XUNIT_PATH: .\tests\ImageSharp.Tests # Required for xunit
210-
211-
- name: Export Failed Output
212-
uses: actions/upload-artifact@v4
213-
if: failure()
214-
with:
215-
name: actual_output_${{ runner.os }}_${{ matrix.options.framework }}${{ matrix.options.runtime }}.zip
216-
path: tests/Images/ActualOutput/
217-
218-
Publish:
219-
needs: [Build]
220-
runs-on: ubuntu-latest
221-
if: (github.event_name == 'push')
222-
steps:
223-
- name: Git Config
224-
shell: bash
225249
run: |
226-
git config --global core.autocrlf false
227-
git config --global core.longpaths true
228-
229-
- name: Git Checkout
230-
uses: actions/checkout@v4
231-
with:
232-
fetch-depth: 0
233-
submodules: recursive
234-
235-
- name: NuGet Install
236-
uses: NuGet/setup-nuget@v2
237-
238-
- name: NuGet Setup Cache
239-
uses: actions/cache@v4
240-
id: nuget-cache
241-
with:
242-
path: ~/.nuget
243-
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
244-
restore-keys: ${{ runner.os }}-nuget-
250+
$date = Get-Date -Format "yyyy.MM.dd"
251+
$buildNumber = "${{ github.run_number }}"
252+
$version = "$date-mc.$buildNumber"
253+
echo "version=$version" >> $env:GITHUB_OUTPUT
254+
echo "Computed version: $version"
245255
246256
- name: DotNet Pack
247257
shell: pwsh
248-
run: ./ci-pack.ps1
258+
run: ./ci-pack.ps1 -version "${{ steps.compute-version.outputs.version }}"
249259

250-
- name: Feedz Publish
251-
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
260+
- name: Azure Login
261+
uses: azure/login@v2
262+
with:
263+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
264+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
265+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
255266

256-
- name: NuGet Publish
257-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
267+
- name: Publish Internal
258268
shell: pwsh
259269
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
270+
sleet push ./artifacts --config sleet.json artifacts

0 commit comments

Comments
 (0)