-
-
Notifications
You must be signed in to change notification settings - Fork 4
85 lines (71 loc) · 2.29 KB
/
cicd.yaml
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
name: CICD
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'alpha'
- 'beta'
- 'dev'
- 'sync-charts'
pull_request:
types: [opened, reopened, synchronize]
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
dry_run: true
extra_plugins: |
@semantic-release/changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Generate Models
shell: pwsh
run: |
$projects = Get-ChildItem -Path $PWD\src\Models -Recurse -Filter *.csproj
foreach($project in $projects){
dotnet run -c Release --project src\KubernetesCRDModelGen.Tool\KubernetesCRDModelGen.Tool.csproj --FolderPath $($project.Directory)
if (-not $?) {
throw "CRD Generation Failed"
}
}
- name: .NET Build
run: dotnet build -c Release
- name: .NET Test
run: dotnet test -c Release --collect:"XPlat Code Coverage"
- name: Coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.cobertura.xml
fail_ci_if_error: false
- name: Benchmarks
working-directory: benchmarks/KubernetesCRDModelGen.Benchmarks
run: dotnet run -c Release
- name: .NET Pack
run: dotnet pack -c Release -p:Version=${{ (steps.semantic.outputs.new_release_published && steps.semantic.outputs.new_release_version) || '1.0.0' }}
- name: Semantic Release
if: steps.semantic.outputs.new_release_published == 'true'
uses: cycjimmy/semantic-release-action@v4
with:
extra_plugins: |
@semantic-release/changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: .NET NuGet Push
if: steps.semantic.outputs.new_release_published == 'true'
run: dotnet nuget push src/**/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
- uses: actions/upload-artifact@v4
with:
name: NuGet Package
path: src/**/*.nupkg