-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (79 loc) · 2.81 KB
/
ci.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
78
79
80
81
82
name: Publish
on:
push: {}
pull_request: {}
release:
types: [published]
env:
Configuration: Release
ProjectDir: src\SourceGenerator.Foundations\
ProjectName: SourceGenerator.Foundations.csproj
SolutionPath: src\SourceGenerator.Foundations.sln
MSBUILDDISABLENODEREUSE: '1' # Stops MSBuild from locking MSBuild nuget package
jobs:
build:
name: Build | All
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Build Solution
run: dotnet test src\SourceGenerator.Foundations.sln
test:
name: Test | ${{ matrix.project.name }}
runs-on: windows-latest
needs: build
strategy:
matrix:
project:
- name: SourceGenerator.Foundations.Tests
- name: ConsoleApp.SourceGenerator.Tests
path: Sandbox/
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Test | ${{ matrix.project.name }}
run: dotnet test src\${{ matrix.project.path }}${{ matrix.project.name }}\${{ matrix.project.name }}.csproj
publish:
name: Publish | ${{ matrix.project.name }}
runs-on: windows-latest
needs:
- test
strategy:
matrix:
project:
- name: SourceGenerator.Foundations
- name: SourceGenerator.Foundations.Contracts
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }} # checkout the correct branch name
fetch-depth: 0 # fetch the whole repo history
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore
run: dotnet tool restore
- name: GitVersion
run: dotnet gitversion /output buildserver
# Build
- name: Build | ${{ matrix.project.name }}
run: dotnet build src\SourceGenerator.Foundations\SourceGenerator.Foundations.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_SemVer}}
# Pack
- name: Pack | ${{ matrix.project.name }}
run: dotnet pack src\${{ matrix.project.name }}\${{ matrix.project.name }}.csproj -p:Version=${{env.GitVersion_AssemblySemVer}} -p:PackageVersion=${{env.GitVersion_FullSemVer}}
# Release
- name: Push | ${{ matrix.project.name }}
if: github.event_name == 'release'
run: dotnet nuget push src\${{ matrix.project.name }}\bin\${{env.Configuration}}\*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json