-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (53 loc) · 2 KB
/
main.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
name: .NET 7 Build, Test, and Release Process
on:
push:
branches: [ main ]
jobs:
build_and_test:
runs-on: windows-latest
outputs:
should-run: ${{ steps.set-output.outputs.should-run }}
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
- name: Restore dependencies
run: dotnet restore ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln
- name: Clean
run: dotnet clean ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release
- name: Build
run: dotnet build ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-restore
- name: Test
run: dotnet test ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-build
- name: Set Output
run: echo "::set-output name=should-run::true"
id: set-output
project_operations:
needs: build_and_test
if: needs.build_and_test.outputs.should-run == 'true'
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Generate Release Notes from Milestone
uses: jeffpatton1971/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
milestone: '<YourMilestone>'
pack_and_publish:
needs: [build_and_test, project_operations]
if: needs.build_and_test.outputs.should-run == 'true'
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
- name: Package
run: dotnet pack ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-build --output nupkgs
- name: Publish NuGet Package
run: |
nuget push **/*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
if: github.ref == 'refs/heads/main' && github.event_name == 'push'