-
Notifications
You must be signed in to change notification settings - Fork 3
92 lines (86 loc) · 2.57 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
83
84
85
86
87
88
89
90
91
92
name: CI
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- main
paths:
- 'src/**'
- 'Directory.Build.props'
- 'Directory.Build.targets'
pull_request:
branches:
- main
paths:
- 'src/**'
release:
types:
- published
env:
# Set the DOTNET_SKIP_FIRST_TIME_EXPERIENCE environment variable to stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Set the build number in MinVer
MINVERBUILDMETADATA: build.${{github.run_number}}
jobs:
build:
name: Build on ${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: 'Checkout'
uses: actions/checkout@v1
- name: 'Git Fetch Tags'
run: git fetch --tags
- name: 'Install .NET SDK'
uses: actions/setup-dotnet@v1
if: ${{ false }}
- name: 'Install .NET 7 SDK'
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.202'
- name: '.NET Info'
run: dotnet --info
- name: '.NET Restore'
run: dotnet tool restore
- name: 'Build Project'
run: dotnet cake --target=Build
- name: 'Pack NuGet'
run: dotnet cake --target=Pack
- name: 'Publish Artifacts'
uses: actions/[email protected]
with:
name: ${{matrix.os}}
path: './Artifacts'
push-github-packages:
name: 'Push GitHub Packages'
needs: build
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
runs-on: windows-latest
steps:
- name: 'Download Artifact'
uses: actions/download-artifact@v1
with:
name: 'windows-latest'
- name: 'NuGet Push'
run: dotnet nuget push .\windows-latest\*.nupkg --source https://nuget.pkg.github.com/daviddesmet/index.json --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}}
push-nuget:
name: 'Push NuGet Packages'
needs: build
if: github.event_name == 'release'
runs-on: windows-latest
steps:
- name: 'Download Artifact'
uses: actions/download-artifact@v1
with:
name: 'windows-latest'
- name: 'NuGet Push'
run: |
Get-ChildItem .\windows-latest -Filter *.nupkg |
Where-Object { !$_.Name.Contains('preview') } |
ForEach-Object { dotnet nuget push $_ --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} }
shell: pwsh