-
-
Notifications
You must be signed in to change notification settings - Fork 660
168 lines (147 loc) · 4.8 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
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 }}
strategy:
matrix:
java: ['11']
steps:
- uses: actions/checkout@v2
# Caches
- name: Gradle cache
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle wrapper cache
uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-wrapper-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-wrapper-
- name: Npm cache
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Node cache
uses: actions/cache@v1
with:
path: node
key: ${{ runner.os }}-node-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-node-
# JDK
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
# Gradle check
- name: Build with Gradle
run: |
./gradlew classes testClasses --parallel --no-daemon
./gradlew check --no-daemon
# Shadow Jar, Tar and Zip
- name: Build jars and distribution archives
if: success() && matrix.java == '11'
run: ./gradlew shadowJar distTar distZip --no-daemon
# Upload artifacts
- name: Copy jar to docker
run: |
cp build/libs/*-all.jar docker/app/akhq.jar
cp build/distributions/akhq-*.tar build/distributions/akhq.tar
cp build/distributions/akhq-*.zip build/distributions/akhq.zip
- name: Upload jar
uses: actions/upload-artifact@v1
if: success() && matrix.java == '11'
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/distributions/akhq-*.tar
build/distributions/akhq-*.zip
# Docker
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
- name: Login to DockerHub
uses: docker/login-action@v1
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@v1
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@v3
if: github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')
with:
images: |
tchiotludo/akhq
ghcr.io/${{ github.repository }}
- name: Publish to registries
uses: docker/build-push-action@v2
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@v2
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 }}