-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (61 loc) · 2.56 KB
/
Release-CI.yml
File metadata and controls
73 lines (61 loc) · 2.56 KB
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
name: release-ci
on:
push:
branches:
- release/**
- release
permissions:
contents: read
jobs:
Build-Test-Publish:
runs-on: ubuntu-latest
env:
working-directory: ${{ github.workspace }}
github-token: '${{ secrets.GH_Packages }}'
nuget-token: '${{ secrets.NUGET_API_KEY }}'
steps:
- name: Step-01 Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.15
with:
versionSpec: 5.x
- name: Step-02 Check out Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Step-03 Calculate Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.15
with:
useConfigFile: true
- name: Step-04 Display Version Info
run: |
echo "NuGetVersion: ${{ steps.gitversion.outputs.NuGetVersion }}"
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.MajorMinorPatch }}"
echo "BranchName: ${{ steps.gitversion.outputs.BranchName }}"
- name: Step-05 Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Step-06 Restore dependencies
run: dotnet restore
working-directory: '${{ env.working-directory }}'
- name: Step-07 Build Version (Stable)
run: dotnet build --configuration Release --no-restore -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
working-directory: '${{ env.working-directory }}'
- name: Step-08 Test Solution
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
working-directory: '${{ env.working-directory }}'
- name: Step-09 Create NuGet Package
run: dotnet pack --configuration Release --no-build --output ./packages -p:PackageVersion=${{ steps.gitversion.outputs.MajorMinorPatch }}
working-directory: '${{ env.working-directory }}'
- name: Step-10 Publish to Github Packages
run: |
dotnet tool install gpr --global
find ./packages -name "*.nupkg" -print -exec gpr push -k ${{ env.github-token }} {} \;
working-directory: '${{ env.working-directory }}'
- name: Step-11 Publish to NuGet.org
if: ${{ env.nuget-token != '' }}
run: |
find ./packages -name "*.nupkg" -print -exec dotnet nuget push {} --skip-duplicate --api-key ${{ env.nuget-token }} --source https://api.nuget.org/v3/index.json \;
working-directory: '${{ env.working-directory }}'