Skip to content

Commit bb33560

Browse files
committed
Publish custom version to custom feed
1 parent 01992b6 commit bb33560

File tree

2 files changed

+20
-29
lines changed

2 files changed

+20
-29
lines changed

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

Lines changed: 14 additions & 28 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
@@ -69,12 +63,6 @@ jobs:
6963
sdk-preview: true
7064
runtime: -x64
7165
codecov: false
72-
- os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable
73-
framework: net10.0
74-
sdk: 10.0.x
75-
sdk-preview: true
76-
runtime: -x64
77-
codecov: false
7866
- os: macos-26
7967
framework: net10.0
8068
sdk: 10.0.x
@@ -99,11 +87,6 @@ jobs:
9987
sdk: 8.0.x
10088
runtime: -x64
10189
codecov: false
102-
- os: macos-13 # macos-latest runs on arm64 runners where libgdiplus is unavailable
103-
framework: net8.0
104-
sdk: 8.0.x
105-
runtime: -x64
106-
codecov: false
10790
- os: macos-26
10891
framework: net8.0
10992
sdk: 8.0.x
@@ -254,19 +237,22 @@ jobs:
254237
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets') }}
255238
restore-keys: ${{ runner.os }}-nuget-
256239

257-
- name: DotNet Pack
240+
- name: Compute Version
241+
id: compute-version
258242
shell: pwsh
259-
run: ./ci-pack.ps1
243+
run: |
244+
$date = Get-Date -Format "yyyy.MM.dd"
245+
$buildNumber = "${{ github.run_number }}"
246+
$version = "$date-mc.$buildNumber"
247+
echo "version=$version" >> $env:GITHUB_OUTPUT
248+
echo "Computed version: $version"
260249
261-
- name: Feedz Publish
250+
- name: DotNet Pack
262251
shell: pwsh
263-
run: |
264-
dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/nuget/index.json --skip-duplicate
265-
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.FEEDZ_TOKEN}} -s https://f.feedz.io/sixlabors/sixlabors/symbols --skip-duplicate
252+
run: ./ci-pack.ps1 -version "${{ steps.compute-version.outputs.version }}"
266253

267-
- name: NuGet Publish
268-
if: ${{ startsWith(github.ref, 'refs/tags/') }}
254+
- name: Publish Internal
269255
shell: pwsh
270256
run: |
271-
dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
272-
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.NUGET_TOKEN}} -s https://api.nuget.org/v3/index.json --skip-duplicate
257+
dotnet nuget push .\artifacts\*.nupkg -k ${{secrets.GITHUB_TOKEN}} -s https://nuget.pkg.github.com/mediaclip/index.json --skip-duplicate
258+
dotnet nuget push .\artifacts\*.snupkg -k ${{secrets.GITHUB_TOKEN}} -s https://nuget.pkg.github.com/mediaclip/index.json --skip-duplicate

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 -p:PackageOutputPath="$PSScriptRoot/artifacts" -p:RepositoryUrl=$repositoryUrl
11+
dotnet pack -c Release -p:PackageOutputPath="$PSScriptRoot/artifacts" -p:RepositoryUrl=$repositoryUrl -p:Version=$Version

0 commit comments

Comments
 (0)