-
-
Notifications
You must be signed in to change notification settings - Fork 13
57 lines (50 loc) · 1.6 KB
/
main.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
name: ci/cd
on:
push:
paths:
- 'src/**'
- '*.sln'
- '*.props'
- '**/*.yml'
pull_request: {}
env:
VERSION_FILE_PATH: src/Directory.Build.props
NUGET_KEY: ${{ secrets.NUGET_KEY }}
TAG_COMMIT: false
jobs:
test_and_publish_if_allowed:
name: test and publish if allowed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: Run tests
run: dotnet test src/ --collect:"XPlat Code Coverage"
- name: Publish code coverage
uses: codecov/codecov-action@v3
with:
flags: integration
files: src/FairyBread.Tests/TestResults/*/coverage.cobertura.xml
- name: Publish FairyBread on version change
if: ${{ endsWith(github.ref, 'main') }}
id: publish_nuget
uses: rohith/publish-nuget@v2
with:
PROJECT_FILE_PATH: src/FairyBread/FairyBread.csproj
TAG_COMMIT: true
- name: Create Release
if: ${{ success() && steps.publish_nuget.outputs.VERSION }}
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.publish_nuget.outputs.VERSION }}
release_name: ${{ steps.publish_nuget.outputs.VERSION }}
draft: false
prerelease: ${{ contains(steps.publish_nuget.outputs.VERSION, 'preview') || contains(steps.publish_nuget.outputs.VERSION, 'rc') }}