forked from adempiere/adempiere-landing-page
-
Notifications
You must be signed in to change notification settings - Fork 0
182 lines (160 loc) · 5.67 KB
/
publish.yaml
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
# 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 Edwin Betancourt, [email protected]
name: Publish Project
on:
release:
types:
- created
- edited
jobs:
# Build dist application ADempiere-Site
build-pages:
name: Build dist ADempiere-Site
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 7
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Blog
env:
NODE_OPTIONS: --max_old_space_size=8192
run: pnpm run build:vite
- name: Upload dist files
uses: actions/upload-artifact@v3
with:
name: adempiere-site
path: dist
# Publish dist binaries to page
publish-app-dist:
name: Upload ADempiere-Site 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-pages
runs-on: ubuntu-latest
steps:
- name: Download build dist app
uses: actions/download-artifact@v3
with:
name: adempiere-site
- name: Compress files for application dist
uses: TheDoctor0/[email protected]
with:
filename: 'Adempiere-Site.zip'
path: './'
- name: Create checksum sha256 file
run: sha512sum Adempiere-Site.zip > Adempiere-Site.zip.sha512
- name: Publish application binary in repository
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'Adempiere-Site.zip'
- name: Publish checksum of file
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: 'Adempiere-Site.zip.sha512'
# 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-pages
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_HUB_REPO_NAME }}" != "" && \
"${{ 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-site
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-docker/production-alpine.Dockerfile
push: true
tags: |
${{ secrets.DOCKER_HUB_REPO_NAME }}:alpine
${{ secrets.DOCKER_HUB_REPO_NAME }}: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-site
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-docker/production.Dockerfile
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
push: true
tags: |
${{ secrets.DOCKER_HUB_REPO_NAME }}:latest
${{ secrets.DOCKER_HUB_REPO_NAME }}:${{ github.event.release.tag_name }}