-
Notifications
You must be signed in to change notification settings - Fork 46
176 lines (148 loc) · 4.54 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: .NET
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
GITHUB_USER: Nihlus
GITHUB_FEED: https://nuget.pkg.github.com/Remora
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
pull-requests: write
contents: write
packages: write
on:
push:
branches: [ main ]
tags: [ '*' ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Build
run: |
dotnet restore
dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release --no-restore --no-build --verbosity minimal --collect:"XPlat Code Coverage" --results-directory ./coverage
- name: Inspect
uses: JetBrains/[email protected]
with:
tool-version: 2023.3.4
solution: Remora.Discord.sln
build: false
no-build: true
telemetry-optout: true
- name: Coverage
uses: irongut/[email protected]
with:
filename: coverage/**/coverage.cobertura.xml
badge: true
format: markdown
indicators: true
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
if: github.event_name == 'pull_request'
with:
recreate: true
path: code-coverage-results.md
- name: Package
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: dotnet pack -c Release --no-restore --no-build --version-suffix "github$GITHUB_RUN_ID"
- uses: actions/upload-artifact@v4
with:
name: nupkg
path: nuget/*
- name: Build Docs
if: github.event_name == 'push'
run: |
dotnet tool restore
cd ./docfx
sed -i -E "s/%APP_VERSION%/${GITHUB_REF_NAME}/" docfx_project/docfx.json
dotnet docfx docfx_project/docfx.json
- uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
name: docfx-site
path: docfx/docfx_project/_site/
permissions:
security-events: write
publish_docs:
name: Publish Documentation
needs: build
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
KEEP_TAG_VERSIONS: 5
steps:
- name: Checkout triggering branch
uses: actions/checkout@v4
with:
path: base
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: site
- name: Prepare
run: bash base/docfx/scripts/prepare.sh
- name: Download documentation artifacts
uses: actions/download-artifact@v4
with:
name: docfx-site
path: site/${{ github.ref_name }}
- name: Build
run: bash base/docfx/scripts/build.sh
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
publish_prerelease_packages:
name: Publish Prerelease Packages
needs: build
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: nupkg
path: nuget
# To ensure that the current version being pushed does not get pruned we prune first.
- name: Prune packages older than 4 versions (new version is the 5th)
uses: smartsquaregmbh/[email protected]
with:
organization: Remora
type: nuget
keep: 4
names: |
Remora.Discord
Remora.Discord.API
Remora.Discord.API.Abstractions
Remora.Discord.Caching
Remora.Discord.Caching.Abstractions
Remora.Discord.Caching.Redis
Remora.Discord.Gateway
Remora.Discord.Extensions
Remora.Discord.Hosting
Remora.Discord.Pagination
Remora.Discord.Interactivity
Remora.Discord.Commands
Remora.Discord.Unstable
Remora.Discord.Rest
- name: Push to GitHub Feed
run: |
for f in ./nuget/*; do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done