-
Notifications
You must be signed in to change notification settings - Fork 9
88 lines (71 loc) · 2.29 KB
/
release.yaml
File metadata and controls
88 lines (71 loc) · 2.29 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
name: Release
on:
release:
types: [released]
env:
SLN: lucene.net.objectmapping.sln
DOTNET_VERSIONS: |
8.0.x
10.0.x
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSIONS }}
- uses: actions/cache@v5
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore dependencies
run: |
dotnet restore $SLN
- name: Build
run: |
dotnet build $SLN --no-restore --configuration Release
- name: Test
run: |
dotnet test $SLN --no-build --configuration Release \
--collect:'XPlat Code Coverage' \
--results-directory 'TestResults/Temp'
- name: Install report generator
if: ${{ !cancelled() }}
run: |
dotnet tool install --global dotnet-reportgenerator-globaltool
- name: Generate report
if: ${{ !cancelled() }}
run: |
reportgenerator -reports:"TestResults/Temp/*/coverage.cobertura.xml" \
-targetdir:coverage '-reporttypes:Html_Dark;MarkdownSummaryGithub'
- name: Write to Job Summary
if: ${{ !cancelled() }}
run: cat coverage/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
publish:
needs: build-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ env.DOTNET_VERSIONS }}
- name: Get version
# Extract the version from the release tag.
run: |
TAG_NAME=$GITHUB_REF_NAME
VERSION=$(echo $TAG_NAME | sed -r 's/^v?([0-9.]+(-.+)?)$/\1/')
echo "Version=$VERSION" >> $GITHUB_ENV
- name: Create NuGet Package
run: |
dotnet pack $SLN --configuration Release --output packages/
- name: Publish NuGet Package
run: |
dotnet nuget push packages/*.nupkg -k $NUGET_AUTH_TOKEN \
-s https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}