-
-
Notifications
You must be signed in to change notification settings - Fork 5
258 lines (223 loc) · 7.73 KB
/
release.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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
name: Release
on:
push:
branches: [ master ]
tags: [ v*.*.* ]
paths-ignore:
- '**.md'
- 'docs/**'
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
build-windows:
name: Build for Windows
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-dotnet@v4.1.0
- run: $env:BUILD_TAG = "-nightly"
if: ${{ !(startsWith(github.ref, 'refs/tags/')) }}
- name: Cache NuGet packages
uses: actions/cache@v4.1.2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
- run: dotnet restore --locked-mode /p:Configuration="Release"
- name: Publish desktop application
run: >
deployment/publish.ps1
"Gnomeshade.Desktop"
"win-x64"
"${{ github.run_number }}"
$env:BUILD_TAG
- name: Build installer
id: publish
run: deployment/build.ps1 "Gnomeshade.Desktop.Installer"
- uses: actions/upload-artifact@v4.4.3
with:
name: ${{ steps.publish.outputs.artifact-name }}
path: ${{ steps.publish.outputs.artifact }}
build-linux:
strategy:
matrix:
project:
- Gnomeshade.Desktop
- Gnomeshade.WebApi
name: Build for Linux
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-dotnet@v4.1.0
- uses: actions/setup-node@v4.1.0
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'source/Gnomeshade.WebApi/Node/package-lock.json'
- run: echo "BUILD_TAG=-nightly"
if: ${{ !(startsWith(github.ref, 'refs/tags/')) }}
- name: Cache NuGet packages
uses: actions/cache@v4.1.2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
- name: Publish project
id: publish
run: >
deployment/publish.sh
"${{ matrix.project }}"
"linux-x64"
"${{ github.run_number }}"
"-nightly"
- uses: actions/upload-artifact@v4.4.3
with:
name: ${{ steps.publish.outputs.artifact-name }}
path: ${{ steps.publish.outputs.artifact }}
build-deb:
name: Build debian package
needs: build-linux
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/download-artifact@v4.1.8
id: download
with:
name: Gnomeshade.WebApi_linux-x64.zip
- name: Build debian package
run: >
deployment/debian.sh
"${{ steps.download.outputs.download-path }}/Gnomeshade.WebApi_linux-x64.zip"
"${{ github.run_number }}"
- uses: actions/upload-artifact@v4.4.3
with:
name: Gnomeshade.WebApi_linux-x64.deb
path: "**/*.deb"
nuget:
name: Publish NuGet packages
runs-on: ubuntu-latest
concurrency: release-nuget
timeout-minutes: 5
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-dotnet@v4.1.0
- name: Cache NuGet packages
uses: actions/cache@v4.1.2
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
- name: Pack package
id: pack
run: deployment/pack-nightly.sh "Gnomeshade.WebApi.Client" "${{ github.run_number }}" "${{ github.ref }}"
- name: Push package to GitHub
run: >
dotnet nuget push "${{ steps.pack.outputs.artifact }}"
--api-key ${{ secrets.GITHUB_TOKEN }}
--source https://nuget.pkg.github.com/VMelnalksnis/index.json
- name: Push package to NuGet
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: >
dotnet nuget push "${{ steps.pack.outputs.artifact }}"
--api-key ${{ secrets.NUGET_KEY }}
--source https://api.nuget.org/v3/index.json
docker-release:
name: Build docker image
runs-on: ubuntu-latest
concurrency: release-docker-release
timeout-minutes: 10
steps:
- uses: actions/checkout@v4.2.2
- uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: ./deployment/docker_push.sh "${{ github.run_number }}" "nightly"
if: ${{ !(startsWith(github.ref, 'refs/tags/')) }}
- run: ./deployment/docker_push.sh "${{ github.run_number }}"
if: ${{ (startsWith(github.ref, 'refs/tags/')) }}
deploy-demo:
name: Deploy demo app
needs: build-linux
runs-on: ubuntu-latest
concurrency: deploy-demo
timeout-minutes: 10
env:
AZURE_APP_NAME: gnomeshade-demo
AZURE_APP_DOMAIN: 'https://gnomeshade-demo.azurewebsites.net/'
steps:
- uses: actions/download-artifact@v4.1.8
id: download
with:
name: Gnomeshade.WebApi_linux-x64.zip
- run: unzip Gnomeshade.WebApi_linux-x64.zip
- run: rm Gnomeshade.WebApi_linux-x64.zip
- uses: azure/login@v2.2.0
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_APP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: '.'
- uses: azure/cli@v2.1.0
name: Update appservice settings
with:
inlineScript: >
az webapp config appsettings set
--resource-group
${{ secrets.AZURE_RESOURCE_GROUP }}
--name
${{ env.AZURE_APP_NAME }}
--settings
Admin__Password="${{ secrets.DEMO_ADMIN_PASSWORD }}"
ConnectionStrings__Gnomeshade="Data Source=/tmp/gnomeshade.db"
Database__Provider="Sqlite"
Jwt__Secret="${{ secrets.DEMO_JWT_SECRET }}"
Jwt__ValidAudience="${{ env.AZURE_APP_DOMAIN }}"
Jwt__ValidIssuer="${{ env.AZURE_APP_DOMAIN }}"
OAuth__GitHub__ClientId="${{ secrets.DEMO_GITHUB_ID }}"
OAuth__GitHub__ClientSecret="${{ secrets.DEMO_GITHUB_SECRET }}"
GNOMESHADE_DEMO="true"
- run: wget --retry-connrefused --retry-on-http-error=502 --waitretry=5 --read-timeout=120 --timeout=120 -t 5 ${{ env.AZURE_APP_DOMAIN }}
create-release:
name: Create release
needs:
- build-windows
- build-linux
- build-deb
runs-on: ubuntu-latest
concurrency: create-release
timeout-minutes: 5
steps:
- uses: actions/download-artifact@v4.1.8
id: download
with:
path: artifacts
- name: Upload artifact to nightly release
if: ${{ !(startsWith(github.ref, 'refs/tags/')) }}
uses: pyTooling/Actions/releaser/composite@v2.1.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: nightly
rm: true
files: |
${{ steps.download.outputs.download-path }}/**/*.zip
${{ steps.download.outputs.download-path }}/**/*.deb
${{ steps.download.outputs.download-path }}/**/*.msi
- name: Create release
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: softprops/action-gh-release@v2.1.0
with:
draft: true
prerelease: false
tag_name: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
${{ steps.download.outputs.download-path }}/**/*.zip
${{ steps.download.outputs.download-path }}/**/*.deb
${{ steps.download.outputs.download-path }}/**/*.msi