-
Notifications
You must be signed in to change notification settings - Fork 24
56 lines (53 loc) · 1.69 KB
/
ci-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
name: CI/CD with Auto Versioning
on:
workflow_dispatch:
# push:
# branches: [ master ]
jobs:
versioning:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version.outputs.new_version }}
steps:
- uses: actions/[email protected]
- name: Bump version and push tag
id: set_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch # Automatically bump patch version
release_branches: release.*,hotfix.*,master
pre_release_branches: feature.*
build:
needs: versioning
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: '8.0'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --no-build -c Release --verbosity normal
- name: Pack
run: dotnet pack --no-build -c Release -o nupkg /p:PackageVersion=${{ needs.versioning.outputs.version }}
- name: Upload NuGet packages as artifacts
uses: actions/[email protected]
with:
name: nuget-packages
path: nupkg/*.nupkg
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download NuGet packages artifacts
uses: actions/[email protected]
with:
name: nuget-packages
path: nupkg
- name: Push to NuGet
run: dotnet nuget push "**/*.nupkg" -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate