-
-
Notifications
You must be signed in to change notification settings - Fork 26
140 lines (114 loc) · 4.09 KB
/
Copy pathdotnet.yml
File metadata and controls
140 lines (114 loc) · 4.09 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
name: Build
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_ENVIRONMENT: github
ASPNETCORE_ENVIRONMENT: github
BUILD_PATH: "${{github.workspace}}/artifacts"
on:
push:
branches:
- master
- develop
tags:
- "v*"
pull_request:
branches:
- master
- develop
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: 10.x
- name: Restore Dependencies
run: dotnet restore
- name: Build Solution
run: dotnet build --no-restore --configuration Release
- name: Run Test
run: dotnet test --no-build --configuration Release --coverlet --coverlet-output-format lcov
- name: Collect Coverage
if: success()
id: coverage
run: |
FILES=$(find ${{github.workspace}} -name 'coverage.*.info' -print | tr '\n' ' ')
echo "files=$FILES" >> $GITHUB_OUTPUT
- name: Report Coverage
if: success() && steps.coverage.outputs.files != ''
uses: coverallsapp/github-action@v2
continue-on-error: true
with:
files: ${{ steps.coverage.outputs.files }}
format: lcov
- name: Create Packages
if: success() && github.event_name != 'pull_request'
run: dotnet pack --configuration Release --no-build --output "${{env.BUILD_PATH}}/packages"
- name: Publish Samples
if: success() && github.event_name != 'pull_request'
run: dotnet publish ./samples/Sample.ClientSide/Sample.ClientSide.csproj --configuration Release --output "${{env.BUILD_PATH}}/sample"
- name: Upload Packages
if: success() && github.event_name != 'pull_request'
uses: actions/upload-artifact@v7
with:
name: packages
path: "${{env.BUILD_PATH}}/packages"
- name: Upload Sample Web Site
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
uses: actions/upload-pages-artifact@v5
with:
name: github-pages
path: "${{env.BUILD_PATH}}/sample/wwwroot"
deploy:
runs-on: ubuntu-latest
needs: build
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
permissions:
contents: read
packages: write
steps:
- name: Download Artifact
uses: actions/download-artifact@v8
with:
name: packages
- name: Publish Packages GitHub
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://nuget.pkg.github.com/loresoft/index.json --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate
done
- name: Publish Packages feedz
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://f.feedz.io/loresoft/open/nuget/index.json --api-key ${{ secrets.FEEDDZ_KEY }} --skip-duplicate
done
- name: Publish Packages Nuget
if: startsWith(github.ref, 'refs/tags/v')
run: |
for package in $(find -name "*.nupkg"); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
done
pages:
runs-on: ubuntu-latest
needs: build
if: success() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v'))
permissions:
pages: write
id-token: write
steps:
- name: Deploy Sample
id: deployment
uses: actions/deploy-pages@v5
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}