-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (42 loc) · 1.25 KB
/
dotnet.yml
File metadata and controls
46 lines (42 loc) · 1.25 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
name: CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
VERSION_PREFIX: 1.4.${{ github.run_number }}
VERSION_REV: ${{ github.run_attempt }}
VERSION_HASH: +${{ github.sha }}
BUILD_CONF: Release
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c $BUILD_CONF --no-restore -p:Version=${VERSION_PREFIX}${VERSION_REV}${VERSION_HASH} -p:FileVersion=${VERSION_PREFIX}.${VERSION_REV} -p:ContinuousIntegrationBuild=true
- name: Test
run: dotnet test -c $BUILD_CONF --no-build
- name: Upload NuGet package
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: '**/*.nupkg'
retention-days: 5
publish-nuget:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Download NuGet packages
uses: actions/download-artifact@v4
with:
name: nuget-packages
- name: Push NuGet package
run: dotnet nuget push **/*.nupkg -s nuget.org -k ${{ secrets.NUGET_API_KEY }}