-
-
Notifications
You must be signed in to change notification settings - Fork 660
179 lines (159 loc) · 5.24 KB
/
main.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
name: Main
on:
push:
branches:
- master
- dev
tags:
- '*'
pull_request:
branches:
- master
- dev
jobs:
check:
name: Check
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- uses: actions/checkout@v4
# Caches
- name: Gradle cache
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}"
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle wrapper cache
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: "${{ runner.os }}-wrapper-${{ hashFiles('**/*.gradle') }}"
restore-keys: |
${{ runner.os }}-wrapper-
- name: Npm cache
uses: actions/cache@v4
with:
path: ~/.npm
key: "${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
${{ runner.os }}-node-
- name: Node cache
uses: actions/cache@v4
with:
path: node
key: "${{ runner.os }}-node-${{ hashFiles('**/*.gradle') }}"
restore-keys: |
${{ runner.os }}-node-
# JDK
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
# Gradle check
- name: Build with Gradle
run: |
./gradlew classes testClasses --parallel --no-daemon
./gradlew check --no-daemon
# report test
- name: Test Report
uses: mikepenz/action-junit-report@v5
if: success() || failure()
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
# Shadow Jar, Tar and Zip
- name: Build jars and distribution archives
if: success()
run: ./gradlew shadowJar distTar distZip --no-daemon
# Upload artifacts
- name: Copy jar to docker
run: |
cp build/libs/akhq-*-all.jar docker/app/akhq.jar
mkdir -p build/dist/
find build/distributions/akhq-*.tar -type f -exec cp "{}" build/dist/ ";"
find build/distributions/akhq-*.zip -type f -exec cp "{}" build/dist/ ";"
- name: Upload jar
uses: actions/upload-artifact@v4
if: success()
with:
name: jar
path: build/libs/
# Release
- name: Changelog
id: changelog
uses: scottbrenner/generate-changelog-action@master
if: startsWith(github.ref, 'refs/tags/')
env:
REPO: ${{ github.repository }}
with:
package-dir: 'client/package.json'
# GitHub Release
- name: Create GitHub release
uses: marvinpinto/action-automatic-releases@latest
if: startsWith(github.ref, 'refs/tags/')
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
build/libs/*-all.jar
build/dist/akhq-*.tar
build/dist/akhq-*.zip
# Docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
- name: Login to DockerHub
uses: docker/login-action@v3
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GHCR
uses: docker/login-action@v3
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
with:
images: |
tchiotludo/akhq
ghcr.io/${{ github.repository }}
tags: |
# set latest tag for master branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
- name: Publish to registries
uses: docker/build-push-action@v6
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
with:
push: true
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
# Slack
- name: Slack notification
uses: 8398a7/action-slack@v3
if: ${{ always() && env.SLACK_WEBHOOK_URL != 0 }}
with:
status: ${{ job.status }}
username: Github Actions
icon_emoji: ':github-actions:'
channel: 'C03H9CEBGS2'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}