-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (89 loc) · 3.01 KB
/
build.yml
File metadata and controls
99 lines (89 loc) · 3.01 KB
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
93
94
95
96
97
98
99
name: Build
on:
push:
branches:
- main
- renovate/*
pull_request:
release:
types:
- published
workflow_dispatch:
env:
DOTNET_NOLOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
MINVERBUILDMETADATA: build.${{github.run_number}}
jobs:
build:
name: Build-${{matrix.os}}
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: "Checkout"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: true
fetch-depth: 0
- name: "Install .NET Core SDK"
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0
- name: "Restore"
run: dotnet restore
- name: "Build"
run: dotnet build --configuration Release --no-restore
- name: "Test"
run: dotnet test --configuration Release --no-build --no-restore
- name: "Pack"
run: |
mkdir -p ./artifacts
dotnet pack --configuration Release --no-build --no-restore \
--include-symbols \
--output ./artifacts
shell: bash
- name: "Publish artifacts"
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
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'
environment:
name: "GitHub Packages"
url: https://github.com/JamieMagee/MicrosoftSecurityUpdates/packages
permissions:
packages: write
runs-on: windows-latest
steps:
- name: "Download Artifact"
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: "windows-latest"
- name: "Dotnet NuGet Add Source"
run: dotnet nuget add source https://nuget.pkg.github.com/JamieMagee/index.json --name GitHub --username JamieMagee --password ${{secrets.GITHUB_TOKEN}}
shell: pwsh
- name: "Dotnet NuGet Push"
run: dotnet nuget push .\*.nupkg --api-key ${{ github.token }} --source GitHub --skip-duplicate
shell: pwsh
push-nuget:
name: "Push NuGet Packages"
needs: build
if: github.event_name == 'release'
environment:
name: "NuGet"
url: https://www.nuget.org/packages/JamieMagee.MicrosoftSecurityUpdates.Client
runs-on: windows-latest
steps:
- name: "Download Artifact"
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: "windows-latest"
- name: "Dotnet NuGet Push"
run: |
Get-ChildItem .\ -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