-
Notifications
You must be signed in to change notification settings - Fork 46
133 lines (108 loc) · 3.36 KB
/
dotnet.yml
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
name: dotnet
on:
push:
branches: [main, support/*]
tags: ["*"]
pull_request:
branches: [main, support/*]
jobs:
build:
runs-on: ubuntu-latest
outputs:
fullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- id: gitversion
uses: gittools/actions/gitversion/[email protected]
- uses: actions/[email protected]
with:
dotnet-version: 6.0.x
- uses: actions/cache@v4
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- run: dotnet restore
- run: dotnet build --configuration Release --no-restore
- run: |
dotnet test \
--configuration Release \
--no-build \
--no-restore \
-p:CollectCoverage=true \
-p:CoverletOutputFormat=opencover \
-p:Exclude="[JsonLD.Test*]*"
- name: Codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
- run: |
dotnet pack \
--include-source \
--configuration Release \
--no-build \
--no-restore \
-p:PackageVersion="${{ steps.gitversion.outputs.fullSemVer }}" \
src/json-ld.net/json-ld.net.csproj \
--output ${{ github.workspace }}/nugets/
- uses: actions/upload-artifact@v4
with:
name: nugets
path: nugets
nuget-push-dev:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: build
steps:
- name: download artifact
uses: actions/download-artifact@v4
with:
name: nugets
- name: setup dotnet
uses: actions/[email protected]
with:
dotnet-version: 6.0.x
source-url: https://nuget.pkg.github.com/linked-data-dotnet/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: nuget push
run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }}
nuget-push-prod:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: nugets
- uses: actions/[email protected]
with:
dotnet-version: 6.0.x
source-url: https://api.nuget.org/v3/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }}
- name: nuget push
run: dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }}
release-artifacts:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: nugets
- name: Upload to stable release
uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: nugets
asset_name: json-ld.net
tag: ${{ github.ref }}
overwrite: true