-
Notifications
You must be signed in to change notification settings - Fork 7
171 lines (147 loc) · 4.2 KB
/
Copy pathdotnet-core.yml
File metadata and controls
171 lines (147 loc) · 4.2 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: .NET Core
on:
push:
tags:
- '*'
branches:
- develop
pull_request:
branches: [ master, develop, release/**, hotfix/** ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
semver: ${{ steps.gitversion.outputs.semVer }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Setup .Net SDKs
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
# Perform the dotnet actions
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output
path: '**/bin/Release'
# Get the version information
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v3.0
if: ${{ success() && contains(github.event_name, 'push') }}
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v3.0
if: ${{ success() && contains(github.event_name, 'push') }}
with:
useConfigFile: true
- name: Display SemVer
if: ${{ success() && contains(github.event_name, 'push') }}
run: |
echo "SemVer: $GITVERSION_SEMVER"
test-linux:
name: Test (Linux)
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore
run: dotnet restore
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-output
- name: Test (net6.0)
run: dotnet test --no-build --configuration Release --framework net6.0
- name: Test (net8.0)
run: dotnet test --no-build --configuration Release --framework net8.0
- name: Test (net10.0)
run: dotnet test --no-build --configuration Release --framework net10.0
test-windows:
name: Test (Windows)
needs: build
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v4
with:
dotnet-version: '3.1.x'
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore
run: dotnet restore
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-output
- name: Test (netcoreapp3.1)
run: dotnet test --no-build --configuration Release --framework netcoreapp3.1
- name: Test (net48)
run: dotnet test --no-build --configuration Release --framework net48
publish:
name: Package and Publish
needs: [build, test-linux, test-windows]
runs-on: ubuntu-latest
if: ${{ success() && contains(github.event_name, 'push') }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 10.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore
run: dotnet restore
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-output
- name: Package
run: dotnet pack --no-build --configuration Release --output ./Packages -p:PackageVersion=${{ needs.build.outputs.semver }}
- name: Push
run: |
cd Packages
dotnet nuget push "*.nupkg" --source https://api.nuget.org/v3/index.json --api-key $NUGET_API_KEY
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}