-
-
Notifications
You must be signed in to change notification settings - Fork 12
210 lines (173 loc) · 6.7 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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: CICD
on:
workflow_dispatch:
push:
branches:
- 'main'
- 'alpha'
- 'beta'
- 'dev'
pull_request:
types: [opened, reopened, synchronize]
jobs:
semantic-release:
name: Bump Version
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@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tests:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
global-json-file: src/global.json
- name: Test Core
working-directory: src/KubeUI.Core.Tests
run: dotnet test -c Release --collect:"XPlat Code Coverage"
- name: Test UI
working-directory: src/KubeUI.UI.Tests
run: dotnet test -c Release --collect:"XPlat Code Coverage"
- name: Coverage
uses: codecov/codecov-action@v3
with:
file: coverage.cobertura.xml
build_web:
name: Build & Deploy Web
needs: [semantic-release, tests]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
global-json-file: src/global.json
- name: Publish
working-directory: src/KubeUI.Web
run: dotnet publish -c Release -p:Version=${{ needs.semantic-release.outputs.new_release_version }} -o bin/publish
- name: Deploy
run: npx netlify deploy ${{ (github.ref == 'refs/heads/alpha' && '--prod') || '' }} --json -d src/KubeUI.Web/bin/publish/wwwroot
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Purge CDN
if: github.ref == 'refs/heads/alpha'
run: |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_SITE_ID }}/purge_cache" \
-H "Authorization: ${{ secrets.CLOUDFLARE_AUTH_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
shell: bash
- name: Publish
working-directory: src/KubeUI.Web
run: Compress-Archive -Path bin/publish/wwwroot/* -DestinationPath KubeUI-${{ needs.semantic-release.outputs.new_release_version }}-web.zip
shell: pwsh
- uses: actions/upload-artifact@v3
with:
name: KubeUI-web
path: src/KubeUI.Web/KubeUI-${{ needs.semantic-release.outputs.new_release_version }}-web.zip
build_windows:
name: Build Windows
needs: [semantic-release, tests]
runs-on: windows-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
global-json-file: src/global.json
- name: Download Inno Setup installer
run: curl -L -o installer.exe https://jrsoftware.org/download.php/is.exe
- name: Install Inno Setup
run: |
./installer.exe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /DIR=inst /DOWNLOADISCRYPT=1 | Out-Null
shell: pwsh
- name: Publish
working-directory: src/KubeUI.WPF
run: dotnet publish -c Release -r win-x64 -p:Version=${{ needs.semantic-release.outputs.new_release_version }} -o bin/publish --self-contained
- name: Package
working-directory: src/KubeUI.WPF
run: ../../inst/iscc.exe "/DMyAppVersion=${{ needs.semantic-release.outputs.new_release_version }}" "/DMyOutputBaseFilename=KubeUI-${{ needs.semantic-release.outputs.new_release_version }}-win-x64" .\setup.iss
- uses: actions/upload-artifact@v3
with:
name: KubeUI-win-x64-setup
path: src/KubeUI.WPF/Output/KubeUI-${{ needs.semantic-release.outputs.new_release_version }}-win-x64.exe
- name: Compress
working-directory: src/KubeUI.WPF
run: Compress-Archive -Path bin/publish/* -DestinationPath KubeUI-${{ needs.semantic-release.outputs.new_release_version }}-win-x64.zip
shell: pwsh
- uses: actions/upload-artifact@v3
with:
name: KubeUI-win-x64
path: src/KubeUI.WPF/KubeUI-${{ needs.semantic-release.outputs.new_release_version }}-win-x64.zip
build_mac:
name: Build Mac
needs: [semantic-release, tests]
runs-on: macos-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
global-json-file: src/global.json
- name: Install maui-maccatalyst
run: dotnet workload install maui-maccatalyst
- name: Publish
working-directory: src/KubeUI.Maui
run: dotnet publish -c Release -f:net8.0-maccatalyst -p:Version=${{ needs.semantic-release.outputs.new_release_version }} -p:ApplicationDisplayVersion=${{ needs.semantic-release.outputs.new_release_version }} -p:ApplicationVersion=${{ needs.semantic-release.outputs.new_release_version }}
- name: Rename
run: mv src/KubeUI.Maui/bin/Release/net8.0-maccatalyst/publish/KubeUI-${{ needs.semantic-release.outputs.new_release_version }}.pkg src/KubeUI.Maui/bin/Release/net8.0-maccatalyst/publish/KubeUI-${{ needs.semantic-release.outputs.new_release_version }}-osx-x64.pkg
- uses: actions/upload-artifact@v3
with:
name: KubeUI-osx-x64
path: src/KubeUI.Maui/bin/Release/net8.0-maccatalyst/publish/KubeUI-${{ needs.semantic-release.outputs.new_release_version }}-osx-x64.pkg
release:
if: needs.semantic-release.outputs.new_release_published == 'true'
name: Create Release
needs: [build_web, build_windows, build_mac]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download artifact win-x64
uses: actions/download-artifact@v3
with:
name: KubeUI-win-x64
path: dist/
- name: Download artifact win-x64
uses: actions/download-artifact@v3
with:
name: KubeUI-win-x64-setup
path: dist/
- name: Download artifact web
uses: actions/download-artifact@v3
with:
name: KubeUI-web
path: dist/
- name: Download artifact osx-x64
uses: actions/download-artifact@v3
with:
name: KubeUI-osx-x64
path: dist/
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}