-
-
Notifications
You must be signed in to change notification settings - Fork 258
301 lines (276 loc) · 9.61 KB
/
ci.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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
name: CI
on:
pull_request:
paths-ignore:
- 'komga-webui/src/locales/*'
push:
branches-ignore:
- 'dependabot/**'
workflow_dispatch:
inputs:
perform_release:
description: 'Perform release'
default: false
type: boolean
bump:
description: 'Bump type'
required: false
default: 'next'
type: choice
options:
- 'next'
- 'major'
- 'minor'
- 'patch'
force_release:
description: 'Force release (in case it went wrong)'
default: false
type: boolean
github_release:
description: 'Create Github Release'
default: true
type: boolean
docker_release:
description: 'Push Docker images'
default: true
type: boolean
msstore_release:
description: 'Release to the MS Store'
default: true
type: boolean
jobs:
test:
runs-on: ubuntu-latest
name: Test JDK ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: 19
java-package: 'jdk'
distribution: 'temurin'
- uses: actions/setup-java@v3
with:
java-version: 17
java-package: 'jdk'
distribution: 'temurin'
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: komga/build/test-results/
- name: Upload Unit Test Reports
if: always()
uses: actions/upload-artifact@v3
with:
name: test-reports
path: komga/build/reports/tests/
webui:
runs-on: ubuntu-latest
name: Test webui builds
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: komga-webui/package-lock.json
- name: npm install
working-directory: komga-webui
run: npm install
- name: npm build
working-directory: komga-webui
run: npm run build
env:
NODE_OPTIONS: "--max-old-space-size=4096"
- name: npm test
working-directory: komga-webui
run: npm run test:unit
version:
runs-on: macos-latest
if: inputs.perform_release || inputs.force_release
outputs:
version_current: ${{ steps.versions.outputs.version_current }}
version_next: ${{ steps.versions.outputs.version_next }}
should_release: ${{ steps.versions.outputs.should_release }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Install svu
run: brew install caarlos0/tap/svu
- name: Compute next version for release
run: |
echo "VERSION_NEXT=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV
echo "VERSION_NEXT_SUFFIX=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV
- name: Set Versions
id: versions
run: |
echo "version_current=`svu --pattern="v[0-9]*" --strip-prefix current`" >> $GITHUB_OUTPUT
echo "version_next=${{ env.VERSION_NEXT_SUFFIX }}" >> $GITHUB_OUTPUT
[[ `svu --pattern="v[0-9]*" --strip-prefix current` != ${{ env.VERSION_NEXT }} ]] && echo "should_release=true" >> $GITHUB_OUTPUT || echo
release:
name: Release
runs-on: ubuntu-latest
needs: [ test, webui, version ]
if: needs.version.outputs.should_release || inputs.force_release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Display versions
run: |
echo "Current version: ${{ needs.version.outputs.version_current }}, should release: ${{ needs.version.outputs.version_next }}"
- name: Update version in gradle.properties
if: needs.version.outputs.should_release #only redo if the version changed
run: sed -i -e "s/version=.*/version=${{ needs.version.outputs.version_next }}/" gradle.properties
- uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: komga-webui/package-lock.json
- uses: actions/setup-java@v3
with:
java-version: '19'
java-package: 'jdk'
distribution: 'temurin'
- uses: actions/setup-java@v3
with:
java-version: '17'
java-package: 'jdk'
distribution: 'temurin'
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: :komga:prepareThymeLeaf :komga:bootJar :komga-tray:jar
env:
NODE_OPTIONS: "--max-old-space-size=4096"
- name: Generate OpenAPI docs
uses: gradle/gradle-build-action@v2
if: needs.version.outputs.should_release #only redo if the version changed
with:
arguments: :komga:generateOpenApiDocs
- name: JReleaser Changelog append
uses: gradle/gradle-build-action@v2
if: needs.version.outputs.should_release #only redo if the version changed
with:
arguments: jreleaserChangelog
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: JReleaser Changelog output
if: always() && needs.version.outputs.should_release
uses: actions/upload-artifact@v3
with:
name: jreleaser-changelog
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties
- name: Release commit and push
uses: EndBug/add-and-commit@v9
if: needs.version.outputs.should_release #only redo if the version changed
with:
message: 'chore(release): ${{ needs.version.outputs.version_next }} [skip ci]'
tag: 'v${{ needs.version.outputs.version_next }}'
default_author: github_actions
- name: Conveyor build apps
uses: hydraulic-software/conveyor/actions/[email protected]
if: inputs.github_release
with:
command: -f conveyor.ci.conf make site -o ./output/release
signing_key: ${{ secrets.CONVEYOR_SIGNING_KEY }}
agree_to_license: 1
env:
APPLE_ASP: ${{ secrets.APPLE_ASP }}
APPLE_ID: ${{ secrets.APPLE_ID }}
- name: Adjust Conveyor output
if: inputs.github_release
run: |
mkdir ./output/site
mv ./output/release/download.html ./output/site/index.html
mv ./output/release/icon.svg ./output/site/
- name: Deploy download page to Github Pages
if: inputs.github_release
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./output/site
cname: download.komga.org
- name: JReleaser Release
if: inputs.github_release
uses: gradle/gradle-build-action@v2
with:
arguments: jreleaserRelease
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: JReleaser Release output
if: always() && inputs.github_release
uses: actions/upload-artifact@v3
with:
name: jreleaser-release
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties
- name: JReleaser Announce
if: inputs.github_release
uses: gradle/gradle-build-action@v2
with:
arguments: jreleaserAnnounce
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: JReleaser Announce output
if: always() && inputs.github_release
uses: actions/upload-artifact@v3
with:
name: jreleaser-announce
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties
- name: JReleaser Publish
if: inputs.docker_release
uses: gradle/gradle-build-action@v2
with:
arguments: jreleaserPublish
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: JReleaser Publish output
if: always() && inputs.docker_release
uses: actions/upload-artifact@v3
with:
name: jreleaser-publish
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties
- name: Conveyor - publish to Microsoft Store
uses: hydraulic-software/conveyor/actions/[email protected]
if: inputs.msstore_release
with:
command: -f conveyor.msstore.ci.conf make ms-store-release -o ./output/msstore
signing_key: ${{ secrets.CONVEYOR_SIGNING_KEY }}
agree_to_license: 1
env:
CONVEYOR_MSSTORE_CLIENT_ID: ${{ secrets.CONVEYOR_MSSTORE_CLIENT_ID }}
CONVEYOR_MSSTORE_CLIENT_SECRET: ${{ secrets.CONVEYOR_MSSTORE_CLIENT_SECRET }}
CONVEYOR_MSSTORE_TENANT_ID: ${{ secrets.CONVEYOR_MSSTORE_TENANT_ID }}