This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
forked from adempiere/adempiere-vue
-
Notifications
You must be signed in to change notification settings - Fork 6
236 lines (199 loc) · 7.12 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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
# This file was contributed by Carlos Parada, Edwin Betancourt, and Yamel Senih from ERP Consultores y Asociados, C.A
name: Publish Project
on:
release:
types:
- created
- edited
jobs:
# Build dist application ADempiere-Vue
build-app:
name: Build dist ADempiere-Vue
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Node configuration
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: 'yarn'
- name: Set tag version into config file
run: sed -i "s|develop-1.0.0|${{ github.event.release.tag_name }}|g" config/default.json
- name: Set tag version into config file
run: sed -i "s|releaseNoForDocumentation|${{ github.event.release.tag_name }}|g" config/default.json
- name: Enable https to install packages
run: git config --global url."https://".insteadOf git://
# - name: Install packages lerna
# run: yarn global add lerna
# - name: Update sub module
# run: git submodule update --init --remote
- name: Install packages
run: yarn ci
- name: Compile dist
run: yarn build:prod
- name: Upload dist app
uses: actions/upload-artifact@v3
with:
name: adempiere-vue
path: dist
# Publish dist binaries to application
publish-app-dist:
name: Upload ADempiere-Vue binaries
# TODO: Does not support edit release: {"resource":"Release","code":"already_exists","field":"tag_name"}
if: ${{ github.event_name == 'release' && github.event.action == 'created' }}
needs:
- build-app
runs-on: ubuntu-latest
steps:
- name: Download build dist app
uses: actions/download-artifact@v3
with:
name: adempiere-vue
- name: Compress files for application dist
uses: TheDoctor0/[email protected]
with:
filename: 'Adempiere-Vue.zip'
path: './'
- name: Publish application binary in repository
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'Adempiere-Vue.zip'
# 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_secret_job.outputs.is_have_secrets }}
steps:
- id: check_secret_job
run: |
if [[ "${{ secrets.DOCKER_REPO_FRONTEND }}" != "" && \
"${{ 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
# 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@v3
- name: Download build dist app
uses: actions/download-artifact@v3
with:
name: adempiere-vue
path: dist
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker Image Alpine
uses: docker/[email protected]
with:
context: .
file: ./build/production-alpine.Dockerfile
push: true
tags: |
${{ secrets.DOCKER_REPO_FRONTEND }}:alpine
${{ secrets.DOCKER_REPO_FRONTEND }}:alpine-${{ github.event.release.tag_name }}
# Publish docker image 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@v3
- name: Download build dist app
uses: actions/download-artifact@v3
with:
name: adempiere-vue
path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
file: ./build/production.Dockerfile
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
push: true
tags: |
${{ secrets.DOCKER_REPO_FRONTEND }}:latest
${{ secrets.DOCKER_REPO_FRONTEND }}:${{ github.event.release.tag_name }}
# Build dist documentation ADempiere-Vue
build-docs:
name: Build dist ADempiere-Vue docs
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Node configuration
uses: actions/setup-node@v3
with:
node-version: 14.x
cache: 'yarn'
- name: Enable https to install packages
run: git config --global url."https://".insteadOf git://
- name: Generate dist docs
run: |
cd docs
yarn ci
yarn build
- name: Upload dist docs
uses: actions/upload-artifact@v3
with:
name: adempiere-vue-docs
path: docs/.vuepress/dist
# Publish dist binaries to documentation
publish-docs-dist:
name: Upload ADempiere-Vue docs binaries
needs:
- build-docs
runs-on: ubuntu-latest
steps:
- name: Download build dist docs
uses: actions/download-artifact@v3
with:
name: adempiere-vue-docs
- name: Compress files for documentation dist
uses: TheDoctor0/[email protected]
with:
filename: 'Adempiere-Vue-Documentation.zip'
path: './'
- name: Publish documentation binary in repository
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'Adempiere-Vue-Documentation.zip'