This repository has been archived by the owner on Jul 10, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (68 loc) · 2.07 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
name: CICD
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'alpha'
- 'beta'
- 'dev'
pull_request:
types: [opened, reopened, synchronize]
merge_group:
jobs:
build-test:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- 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@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.cobertura.xml
fail_ci_if_error: true
create-release:
if: ${{ github.event_name != 'pull_request' }}
name: Create Release
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: .NET Pack
run: dotnet pack -c Release -p:Version=${{ (steps.semantic.outputs.new_release_published && steps.semantic.outputs.new_release_version) || '0.0.1' }}
- 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 }} --skip-duplicate
- name: Semantic Release
if: steps.semantic.outputs.new_release_published == 'true'
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: NuGet Package
path: src/**/*.nupkg