-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (142 loc) · 6.57 KB
/
dotnet8.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: .NET 8
on:
workflow_dispatch:
push:
branches: [ "dotnet8" ]
pull_request:
branches: [ "dotnet8" ]
jobs:
build:
name: Build
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
version: [ 8.x ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.version }}
- name: Login into Github Packeges
run: dotnet nuget add source --store-password-in-clear-text "https://nuget.pkg.github.com/Takasaki-Studio/index.json" --name github --username ${{ secrets.USERNAME }} --password ${{ secrets.SECRET }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore /WarnAsError
test:
name: Test
strategy:
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
version: [ 8.x ]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.version }}
- name: Login into Github Packeges
run: dotnet nuget add source --store-password-in-clear-text "https://nuget.pkg.github.com/Takasaki-Studio/index.json" --name github --username ${{ secrets.USERNAME }} --password ${{ secrets.SECRET }}
- name: Restore dependencies
run: dotnet restore
- name: Test
run: dotnet test --verbosity normal
sonar:
name: Sonar Qube
needs: [ build, test ]
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~\.sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarQube scanner
id: cache-sonar-scanner
uses: actions/cache@v4
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarQube scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Takasaki-Studio_Lina_15f9a6a7-ef3c-4937-88f6-40e4f890d8f1" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="${{ secrets.SONAR_HOST_URL }}"
dotnet build
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
publish_github:
name: Publish Github
needs: [ sonar ]
environment: 'Production'
runs-on: ubuntu-latest
if: github.ref_name == 'dotnet8' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Add Nuget Source
run: dotnet nuget add source --store-password-in-clear-text "https://nuget.pkg.github.com/Takasaki-Studio/index.json" --username "${{ secrets.USERNAME }}" --password "${{ secrets.SECRET }}" --name "github"
- name: Publish TakasakiStudio.Lina.Common to Github Package
run: dotnet nuget push "./TakasakiStudio.Lina.Common/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github"
- name: Publish TakasakiStudio.Lina.AutoDependencyInjection to Github Package
run: dotnet nuget push "./TakasakiStudio.Lina.AutoDependencyInjection/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github"
- name: Publish TakasakiStudio.Lina.Utils to Github Package
run: dotnet nuget push "./TakasakiStudio.Lina.Utils/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github"
- name: Publish TakasakiStudio.Lina.Database to Github Package
run: dotnet nuget push "./TakasakiStudio.Lina.Database/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github"
- name: Publish TakasakiStudio.Lina.AspNet to Github Package
run: dotnet nuget push "./TakasakiStudio.Lina.AspNet/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github"
- name: Publish TakasakiStudio.Lina to Github Package
run: dotnet nuget push "./TakasakiStudio.Lina/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "github"
publish_nuget:
name: Publish Nuget
needs: [ sonar ]
environment: 'Production Nuget'
runs-on: ubuntu-latest
if: github.ref_name == 'dotnet8' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release
- name: Publish TakasakiStudio.Lina.Common to Nuget
run: dotnet nuget push "./TakasakiStudio.Lina.Common/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org"
- name: Publish TakasakiStudio.Lina.AutoDependencyInjection to Nuget
run: dotnet nuget push "./TakasakiStudio.Lina.AutoDependencyInjection/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org"
- name: Publish TakasakiStudio.Lina.Utils to Nuget
run: dotnet nuget push "./TakasakiStudio.Lina.Utils/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org"
- name: Publish TakasakiStudio.Lina.Database to Nuget
run: dotnet nuget push "./TakasakiStudio.Lina.Database/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org"
- name: Publish TakasakiStudio.Lina.AspNet to Nuget
run: dotnet nuget push "./TakasakiStudio.Lina.AspNet/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org"
- name: Publish TakasakiStudio.Lina to Nuget
run: dotnet nuget push "./TakasakiStudio.Lina/bin/Release/*.nupkg" --api-key ${{ secrets.SECRET }} --source "nuget.org"