-
-
Notifications
You must be signed in to change notification settings - Fork 1
111 lines (111 loc) · 3.11 KB
/
build.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build
on:
push:
branches: [main]
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
pull_request:
release:
types: [published]
schedule:
- cron: '0 3 * * *'
jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
scan:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Run SonarScanner
uses: highbyte/sonarscan-dotnet@v2.1.3
with:
sonarProjectKey: netboot_utility_license
sonarProjectName: Netboot Utility License
sonarHostname: https://sonarqube.netboot.fr
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Initialize CodeQL
if: github.ref == 'refs/heads/main'
uses: github/codeql-action/init@v2
with:
languages: 'csharp'
- name: Build Solution
run: dotnet build --configuration Release
- name: Test Solution
run: dotnet test --no-build --configuration Release
- name: Analyse Solution
if: github.ref == 'refs/heads/main'
uses: github/codeql-action/analyze@v2
pack:
runs-on: ubuntu-latest
needs: [build, linter]
if: github.event_name == 'push' || github.event_name == 'release'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Pack for publish
if: github.event_name == 'release'
run: dotnet pack --output ./artifacts --configuration Release -p:PackageVersion=${{ github.event.release.tag_name }}
- name: Pack for push
if: github.event_name == 'push'
run: dotnet pack --output ./artifacts --configuration Release
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: ./artifacts
publish:
runs-on: ubuntu-latest
needs: pack
if: github.event_name == 'release'
steps:
- name: Setup .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- uses: actions/download-artifact@v3
with:
name: artifacts
path: ./artifacts
- name: Publish packages
run: dotnet nuget push ./artifacts/**/*.nupkg --source nuget.org --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate