-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (49 loc) · 1.56 KB
/
publish.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
name: Publish Mailgen Package
on:
push:
branches:
- '*'
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [6.0.x, 8.0.x]
include:
- dotnet-version: 6.0.x
- dotnet-version: 8.0.x
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: dotnet restore Mailgen/Mailgen.csproj
- name: Build
run: dotnet build Mailgen/Mailgen.csproj --configuration Release --no-restore
- name: Test
run: dotnet test Mailgen/Mailgen.csproj --no-restore --verbosity normal
publish:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore Mailgen/Mailgen.csproj
- name: Build
run: dotnet build Mailgen/Mailgen.csproj --configuration Release --no-restore
- name: Pack
run: dotnet pack Mailgen/Mailgen.csproj --configuration Release --no-restore --output nupkg
- name: Publish to NuGet
run: dotnet nuget push nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json