generated from hughesjs/dotnet-8-ci-cd-template
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (79 loc) · 2.5 KB
/
dotnet-cd.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
name: .NET Continuous Deployment
on:
push:
branches: [ master ]
paths:
- src/SuperFluid/**
workflow_dispatch:
jobs:
test:
name: Test Project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Run tests
run: dotnet test --logger GitHubActions ./src/SuperFluid.sln
semantic-release:
permissions: write-all
needs: test
name: Create a Package Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 # Need the full commit history for conventional commit
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
- name: Create Nuget Package
run: dotnet build -c Release ./src/SuperFluid/SuperFluid.csproj && dotnet pack -c Release -p:PackageVersion=${{ steps.tag_version.outputs.new_version }} -o . ./src/SuperFluid/SuperFluid.csproj
- name: Upload Package for Publishing
uses: actions/upload-artifact@v4
with:
name: PackedLib
path: ./*.nupkg
github-publish:
permissions: write-all
needs: semantic-release
name: Publish to Github
runs-on: ubuntu-latest
steps:
- name: Download built project
uses: actions/download-artifact@v4
with:
name: PackedLib
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Push Package to GitHub
run: dotnet nuget push --api-key ${{secrets.GITHUB_TOKEN}} --source "https://nuget.pkg.github.com/hughesjs/index.json" *.nupkg
nuget-publish:
needs: semantic-release
name: Publish to Nuget
runs-on: ubuntu-latest
steps:
- name: Download built project
uses: actions/download-artifact@v4
with:
name: PackedLib
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Push Package to Nuget
run: dotnet nuget push --api-key ${{secrets.NUGET_KEY}} --source "https://api.nuget.org/v3/index.json" *.nupkg