-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (60 loc) · 2.18 KB
/
cicd.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
name: Library Release
on:
push:
branches:
- main
permissions:
contents: read
packages: write
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dotnet-version: [6.0.x,7.0.x,8.0.x]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup .NET ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install Dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore --nologo
- name: Test
run: dotnet test --configuration Release --no-build --no-restore --verbosity normal
publish:
name: Publish Package
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install Dependencies
run: dotnet restore
- name: Setup GitFlow
uses: gittools/actions/gitversion/setup@v1.1.1
with:
versionSpec: '5.x'
- name: Determine Version
uses: gittools/actions/gitversion/execute@v1.1.1
- name: Build
run: dotnet build -c Release --no-restore /p:Version="${{ env.GitVersion_SemVer }}" /p:AssemblyVersion="${{ env.GitVersion_AssemblySemVer }}" /p:FileVersion="${{ env.GitVersion_AssemblySemFileVer }}"
- name: Pack the Nuget Packages
run: dotnet pack -c Release --no-build --no-restore --include-symbols --include-source --output nupkgs /p:PackageVersion="${{ env.GitVersion_NuGetVersionV2 }}"
- name: Publish the Nuget Packages to the GitHub Package Registry
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/deveel/index.json"
clean:
name: Clean Pre-Release Packages
needs: publish
uses: ./.github/workflows/clean-packages.yml