-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (68 loc) · 2.33 KB
/
build.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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build, Test & Package
on:
push:
branches: [ "main" ]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
pull_request:
branches: [ "main" ]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"
jobs:
build:
name: Build, Test & Package
runs-on: ubuntu-latest
steps:
- name: Get source
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Restore dependencies
run: dotnet restore
- name: Build & Package
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release
- name: Publish artifacts
uses: actions/upload-artifact@v3
with:
name: nuget-package
path: artifacts/*.nupkg
publish_github:
name: Publish package to GitHub Package Repository
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
# - name: Add GitHub Package Repository source
# run: dotnet nuget add source --username ${{ secrets.GPR_USERNAME }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name GPR ${{ secrets.GPR_URL }}
# - name: Push to GitHub Packages
# run: dotnet nuget push **.nupkg -s "GPR" --skip-duplicate
- name: Push to GitHub package registry
run: |
dotnet nuget push **.nupkg \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--source https://nuget.pkg.github.com/${{ github.repository_owner }}
- name: Delete old packages
uses: smartsquaregmbh/[email protected]
with:
keep: 5
names: Synto
publish_nuget:
name: Publish Package to NuGet.org
if: ${{ github.ref == 'refs/heads/main' }}
needs: build
environment: NuGet.org
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Publish to NuGet.org
run: dotnet nuget push **.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_API_KEY }}