-
-
Notifications
You must be signed in to change notification settings - Fork 12
192 lines (166 loc) · 5.82 KB
/
cicd.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: CICD
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'alpha'
- 'beta'
- 'dev'
pull_request:
types: [opened, reopened, synchronize]
permissions:
id-token: write
contents: write
actions: write
checks: write
jobs:
build-test:
name: Build & Test
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet test -c Release --collect:"XPlat Code Coverage" --no-build --logger "trx;LogFileName=test-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: KubeUI Tests
path: tests/KubeUI.Tests/TestResults/test-results.trx
reporter: dotnet-trx
- name: Coverage
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.cobertura.xml
fail_ci_if_error: false
semantic-release:
name: Bump Version
needs: [build-test]
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published }}
new_release_version: ${{ (steps.semantic.outputs.new_release_published && steps.semantic.outputs.new_release_version) || '0.0.1' }}
steps:
- uses: actions/checkout@v4
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-matrix:
name: Publish Installers
runs-on: ${{ matrix.runs-on }}
needs: [semantic-release]
environment: production
strategy:
matrix:
include:
- rid: win-x64
fileName: KubeUI.Desktop.exe
runs-on: windows-latest
packParam: --icon ../KubeUI/Assets/icon.ico --azureTrustedSignFile metadata.json --verbose --signSkipDll
- rid: win-arm64
fileName: KubeUI.Desktop.exe
runs-on: windows-latest
packParam: --icon ../KubeUI/Assets/icon.ico --azureTrustedSignFile metadata.json --verbose --signSkipDll
- rid: linux-x64
fileName: KubeUI.Desktop
runs-on: ubuntu-latest
packParam: ''
- rid: linux-arm64
fileName: KubeUI.Desktop
runs-on: ubuntu-latest
packParam: ''
- rid: osx-x64
fileName: KubeUI.Desktop
runs-on: macos-latest
packParam: --icon ../KubeUI/Assets/icon.icns --plist info.plist
- rid: osx-arm64
fileName: KubeUI.Desktop
runs-on: macos-latest
packParam: --icon ../KubeUI/Assets/icon.icns --plist info.plist
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x.x'
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install Velopack
run: dotnet tool install -g vpk
- name: Install Velopack Deps
if: matrix.runs-on == 'ubuntu-latest'
run: sudo apt install libfuse2
- name: Publish
working-directory: src/KubeUI.Desktop
run: dotnet publish -c Release -r ${{ matrix.rid }} -o bin/publish -p:Version=${{ needs.semantic-release.outputs.new_release_version }}
- name: Replace single file
if: matrix.runs-on == 'macos-latest'
uses: richardrigutins/replace-in-files@v2
with:
files: 'src/KubeUI.Desktop/info.plist'
search-text: '{{version}}'
replacement-text: ${{ needs.semantic-release.outputs.new_release_version }}
- name: Azure Login
if: matrix.runs-on == 'windows-latest'
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Write metadata.json
working-directory: src/KubeUI.Desktop
if: matrix.runs-on == 'windows-latest'
shell: pwsh
run: |
[System.Text.Encoding]::UTF8.GetBytes($env:SECRET) | Set-Content -Path metadata.json -AsByteStream
env:
SECRET : ${{ secrets.AZURETRUSTEDSIGNFILE }}
- name: Create Release
working-directory: src/KubeUI.Desktop
run: |
vpk download github --repoUrl https://github.com/${{ github.repository }} --token ${{ secrets.GITHUB_TOKEN }} -c ${{ matrix.rid }} --pre
vpk pack --packTitle KubeUI -u KubeUI -v ${{ needs.semantic-release.outputs.new_release_version }} -p bin/publish -c ${{ matrix.rid }} -e ${{ matrix.fileName }} -o packed ${{ matrix.packParam }} --packAuthors "Ivan Josipovic"
- name: Remove unnecessary assets
working-directory: src/KubeUI.Desktop
shell: pwsh
run: |
Remove-Item -Path packed/assets.*
Remove-Item -Path packed/RELEASES-*
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.rid }}-artifacts
path: src/KubeUI.Desktop/packed
release:
if: needs.semantic-release.outputs.new_release_published == 'true'
name: Create Release
needs: [semantic-release, publish-matrix]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist/
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}