-
Notifications
You must be signed in to change notification settings - Fork 2
60 lines (50 loc) · 1.67 KB
/
ci.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
name: Continuous Integration
on:
push:
branches:
- main
- develop
pull_request:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
filter: tree:0
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Display .NET information
run: dotnet --info
- name: Build solution
run: dotnet build --configuration Release
- name: Run unit tests
run: dotnet test ./test/Moniker.Tests --configuration Release --no-build --no-restore
- name: Run approval tests
run: dotnet test ./test/Moniker.ApprovalTests --configuration Release --no-build --no-restore
- name: Create NuGet packages
run: dotnet pack --configuration Release
- name: Publish NuGet packages to GitHub Packages
if: github.event_name == 'push'
run: |
dotnet nuget add source \
--username alexmg \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text \
--name github \
https://nuget.pkg.github.com/alexmg/index.json
dotnet nuget push '**/*.nupkg' \
--source github \
--api-key ${{ secrets.GITHUB_TOKEN }}
- name: Publish NuGet packages to NuGet.org
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
dotnet nuget push '**/*.nupkg' \
--source 'https://api.nuget.org/v3/index.json' \
--api-key ${{ secrets.NUGET_API_KEY }}