-
Notifications
You must be signed in to change notification settings - Fork 1
125 lines (104 loc) · 3.84 KB
/
ci.yml
File metadata and controls
125 lines (104 loc) · 3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: CI
on:
push:
branches: [master, main, develop, "release/**", "hotfix/**", "feature/**"]
tags: ["*"]
pull_request:
branches: [master, main, develop]
permissions:
contents: read
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
CONFIGURATION: Release
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ["8.0.x", "9.0.x", "10.0.x"]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Restore
run: dotnet restore EventHorizon.sln
- name: Build
run: dotnet build EventHorizon.sln --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Test
run: dotnet test EventHorizon.sln --configuration ${{ env.CONFIGURATION }} --no-build --logger "trx;LogFileName=results.trx" --filter "Category!=Integration"
continue-on-error: false
publish:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/') || startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/tags/'))
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4
with:
versionSpec: '6.x'
- name: Determine version
id: version
uses: gittools/actions/gitversion/execute@v4
with:
useConfigFile: true
- name: Restore
run: dotnet restore EventHorizon.sln
- name: Build
run: dotnet build EventHorizon.sln --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Pack NuGet packages
run: |
VERSION="${{ steps.version.outputs.semVer }}"
for proj in src/EventHorizon.*/EventHorizon.*.csproj; do
ASSEMBLY_NAME=$(basename "$(dirname "$proj")")
PACKAGE_ID="${ASSEMBLY_NAME}"
echo "Packing ${PACKAGE_ID} v${VERSION}"
dotnet pack "$proj" \
--configuration ${{ env.CONFIGURATION }} \
--no-build \
--output ./artifacts \
-p:PackageId="${PACKAGE_ID}" \
-p:PackageVersion="${VERSION}" \
-p:Version="${VERSION}"
done
- name: NuGet login (trusted publishing)
uses: NuGet/login@v1
id: nuget-login
with:
user: potatman
- name: Push to NuGet.org
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
run: |
dotnet nuget push "./artifacts/*.nupkg" \
--api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: Push pre-release to NuGet.org
if: startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/hotfix/') || github.ref == 'refs/heads/develop'
run: |
dotnet nuget push "./artifacts/*.nupkg" \
--api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: ./artifacts/*.nupkg
retention-days: 30