-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (76 loc) · 2.71 KB
/
release.yml
File metadata and controls
93 lines (76 loc) · 2.71 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
name: Release
on:
release:
types: [published]
env:
DOTNET_VERSION: "10.0.x"
NODE_VERSION: "20"
jobs:
test:
name: Test
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --no-restore --configuration Release
- name: Run unit tests
run: dotnet test --no-build --verbosity normal --configuration Release /p:CollectCoverage=true /p:Threshold=80 /p:ThresholdType=line /p:ThresholdStat=Average /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/ /p:ExcludeByAttribute="GeneratedCodeAttribute"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de
with:
token: ${{ secrets.CODECOV_TOKEN }}
publish-packages:
name: Publish Package to GitHub Packages and NuGet.org
runs-on: ubuntu-latest
if: github.repository_owner == 'BpsLogicBuilder'
permissions:
contents: read
packages: write
id-token: write
needs: test
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
source-url: https://nuget.pkg.github.com/bpsLogicBuilder/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: NuGet login
uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544
id: nuget_login
with:
user: ${{ secrets.NUGET_USER }}
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --no-restore --configuration Release
- name: Publish Packages
run: |
dotnet pack --configuration Release --no-build -o ./nupkg
dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --api-key ${{ env.GITHUB_TOKEN }}
dotnet nuget push ./nupkg/*.nupkg --skip-duplicate --source ${{ env.NUGET_URL }} --api-key ${{ steps.nuget_login.outputs.NUGET_API_KEY }}
env:
NUGET_URL: 'https://api.nuget.org/v3/index.json'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}