-
Notifications
You must be signed in to change notification settings - Fork 15
70 lines (52 loc) · 1.89 KB
/
nuget-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
65
66
67
68
69
name: NuGet Publish
on:
push:
branches: [ master ]
env:
NUGET_DIR: ${{ github.workspace }}/nuget
NUGET_ARTIFACT: nuget
jobs:
testing:
if: contains(github.event.head_commit.message, 'chore(release)')
uses: ./.github/workflows/test.yml
pack:
if: contains(github.event.head_commit.message, 'chore(release)')
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Setup .NET Core
uses: actions/[email protected]
- run: sed -E -i'.bak' 's:RepositoryCommit>.+</:RepositoryCommit>${{ github.sha }}</:g' ButterCMS/ButterCMS.csproj
- run: dotnet pack --configuration Release --output "${{ env.NUGET_DIR }}"
- uses: actions/[email protected]
with:
name: ${{ env.NUGET_ARTIFACT }}
path: ${{ env.NUGET_DIR }}
if-no-files-found: error
retention-days: 1
validate-nuget:
runs-on: ubuntu-22.04
needs: pack
steps:
- name: Setup .NET Core
uses: actions/[email protected]
- uses: actions/[email protected]
with:
name: ${{ env.NUGET_ARTIFACT }}
path: ${{ env.NUGET_DIR }}
- name: Install nuget validator
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
- name: Validate nuget package
run: meziantou.validate-nuget-package --excluded-rules Symbols ${{ env.NUGET_DIR }}/*.nupkg
publish:
runs-on: ubuntu-22.04
needs: [validate-nuget, testing]
steps:
- uses: actions/[email protected]
with:
name: ${{ env.NUGET_ARTIFACT }}
path: ${{ env.NUGET_DIR }}
- name: Setup .NET Core
uses: actions/[email protected]
- name: Publish nuget package
run: dotnet nuget push "${{ env.NUGET_DIR }}/*.nupkg" --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json