forked from adempiere/backend
-
Notifications
You must be signed in to change notification settings - Fork 9
295 lines (249 loc) · 9.49 KB
/
publish.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
# This workflow will build a Java project with Gradle
# This file was contributed by [email protected] from ERP Consultores y Asociados, C.A
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Publish Project
on:
release:
types:
- created
jobs:
# Build dist application adempiere-grpc-server
build-app:
name: Build dist ADempiere gRPC Server
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Java JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-package: 'jdk'
java-version: 11
architecture: x64
- name: Set Main Version
run: echo "MAIN_VERSION=${{ github.event.release.name }}" >> src/main/java/org/spin/base/version.properties
- name: Set Release Date
run: echo "DATE_VERSION=$(date +'%Y-%m-%d')" >> src/main/java/org/spin/base/version.properties
- name: Set Implementation Version
run: echo "IMPLEMENTATION_VERSION=${{ github.event.release.tag_name }}" >> src/main/java/org/spin/base/version.properties
- name: Build with Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.10
- name: Run Create Release
run: gradle createRelease
env:
GITHUB_DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
GITHUB_DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
- name: Upload descriptor file artifact
uses: actions/upload-artifact@v4
with:
name: adempiere-grpc-server.pb
path: build/descriptors/adempiere-grpc-server.pb
retention-days: 1
- name: Upload envoy file artifact
uses: actions/upload-artifact@v4
with:
name: envoy.yaml
path: resources/envoy.yaml
retention-days: 1
- name: Upload dist app zip artifact
uses: actions/upload-artifact@v4
with:
name: adempiere-grpc-server.zip
path: build/release/adempiere-grpc-server.zip
retention-days: 1
- name: Upload dist app zip.MD5 artifact
uses: actions/upload-artifact@v4
with:
name: adempiere-grpc-server.zip.MD5
path: build/release/adempiere-grpc-server.zip.MD5
retention-days: 1
- name: Upload dist app tar artifact
uses: actions/upload-artifact@v4
with:
name: adempiere-grpc-server.tar
path: build/release/adempiere-grpc-server.tar
retention-days: 1
- name: Upload dist app tar.MD5 artifact
uses: actions/upload-artifact@v4
with:
name: adempiere-grpc-server.tar.MD5
path: build/release/adempiere-grpc-server.tar.MD5
retention-days: 1
publish-binaries:
name: Upload Binaries adempiere-grpc-server
needs: build-app
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Upload Descriptor
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: adempiere-grpc-server.pb/adempiere-grpc-server.pb
- name: Upload Envoy config
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: envoy.yaml/envoy.yaml
- name: Upload zip
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: adempiere-grpc-server.zip/adempiere-grpc-server.zip
- name: Upload zip.MD5
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: adempiere-grpc-server.zip.MD5/adempiere-grpc-server.zip.MD5
- name: Upload tar
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: adempiere-grpc-server.tar/adempiere-grpc-server.tar
- name: Upload tar.MD5
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: adempiere-grpc-server.tar.MD5/adempiere-grpc-server.tar.MD5
# Check secrets to push image in docker hub registry
check-docker-secrets:
name: Check if docker hub registry information was set on secrets
needs:
- build-app
runs-on: ubuntu-latest
outputs:
is_have_secrets: ${{ steps.check_docker_hub_secrets_job.outputs.is_have_secrets }}
steps:
- id: check_docker_hub_secrets_job
run: |
if [[ "${{ secrets.DOCKER_REPO_ADEMPIERE_GRPC_SERVER }}" != "" && \
"${{ secrets.DOCKER_USERNAME }}" != "" && \
"${{ secrets.DOCKER_TOKEN }}" != "" ]]; \
then
echo "Secrets to use a container registry are configured in the repo"
echo "is_have_secrets=true" >> $GITHUB_OUTPUT
else
echo "Secrets to use a container registry were not configured in the repo"
echo "is_have_secrets=false" >> $GITHUB_OUTPUT
fi
# TODO: Download .tar and add docker image without uncompress
# Publish docker alpine image in Docker Hub Registry to application
push-alpine-imame-dhr:
name: Push docker alpine image to Docker Hub
needs:
- check-docker-secrets
# Skip step based on secret
if: needs.check-docker-secrets.outputs.is_have_secrets == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Download build dist app
uses: actions/download-artifact@v4
with:
name: adempiere-grpc-server.zip
- name: Unzip Asset
run: |
unzip adempiere-grpc-server.zip -d docker/
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push alpine image in Docker Hub
uses: docker/build-push-action@v6
with:
context: .
file: docker/alpine.Dockerfile
push: true
tags: |
${{ secrets.DOCKER_REPO_ADEMPIERE_GRPC_SERVER }}:alpine
${{ secrets.DOCKER_REPO_ADEMPIERE_GRPC_SERVER }}:alpine-${{ github.event.release.tag_name }}
# TODO: Download .tar and add docker image without uncompress
# Publish docker image multiplatform in Docker Hub Registry to application
push-imame-dhr:
name: Push docker image to Docker Hub
needs:
- check-docker-secrets
# Skip step based on secret
if: needs.check-docker-secrets.outputs.is_have_secrets == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Download build dist app
uses: actions/download-artifact@v4
with:
name: adempiere-grpc-server.zip
- name: Unzip Asset
run: |
unzip adempiere-grpc-server.zip -d docker/
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push image in Docker Hub
uses: docker/build-push-action@v6
with:
context: .
file: docker/focal.Dockerfile
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
push: true
tags: |
${{ secrets.DOCKER_REPO_ADEMPIERE_GRPC_SERVER }}:${{ github.event.release.tag_name }}
${{ secrets.DOCKER_REPO_ADEMPIERE_GRPC_SERVER }}:latest
# Publish docker image multiplatform in Docker Hub Registry to application
push-grpc-proxy-imame-dhr:
name: Push grpc-proxy docker image to Docker Hub
needs:
- check-docker-secrets
# Skip step based on secret
if: needs.check-docker-secrets.outputs.is_have_secrets == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Download build dist app
uses: actions/download-artifact@v4
with:
name: adempiere-grpc-server.pb
path: docker/
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push image in Docker Hub
uses: docker/build-push-action@v6
with:
context: .
file: docker/grpc_proxy.Dockerfile
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
push: true
tags: |
${{ secrets.DOCKER_HUB_PROXY_REPO_NAME }}:${{ github.event.release.tag_name }}
${{ secrets.DOCKER_HUB_PROXY_REPO_NAME }}:latest