-
-
Notifications
You must be signed in to change notification settings - Fork 582
116 lines (107 loc) · 3.71 KB
/
DINAR.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
# Copyright 2020 IT Projects Labs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "DINAR: Docker Image Building"
on:
push:
paths:
- ".DINAR/**"
- ".github/workflows/DINAR.yml"
# Cron works only for defaul branch. See https://github.com/itpp-labs/DINAR/issues/48
schedule:
- cron: "5 5 * * 0"
jobs:
check-secret:
runs-on: ubuntu-latest
steps:
- name: Check that DINAR_TOKEN is set
run: |
if [ -z "${{ secrets.DINAR_TOKEN }}" ]
then
echo "DINAR_TOKEN is not set"
exit 1
fi
check-branch:
runs-on: ubuntu-latest
steps:
- name: Check that this branch needs docker images
run: |
REF=${GITHUB_BASE_REF:-${GITHUB_REF}}
BRANCH=${REF##*/}
CHECK=$( echo "$BRANCH" | grep -E "^(master|[0-9]+\.[0-9]+)(-dev-.+)?$" || true)
if [ -z "$CHECK" ]
then
echo "This branch is not supposed to be a target of pull requests, so docker image is not needed."
echo "For information check https://github.com/itpp-labs/DINAR/issues/60"
exit 1
fi
rebuild-images:
runs-on: ubuntu-latest
needs:
- check-secret
- check-branch
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
path: REPO
- name: Checkout DINAR
uses: actions/checkout@v2
with:
path: DINAR
repository: itpp-labs/DINAR-fork
ref: master
- uses: actions/setup-python@v1
with:
python-version: "3.7.x"
- name: Prepare build folder
run: |
cp -rnT DINAR/embedded-files/ REPO/
- name: Configure Docker
run: |
bash DINAR/workflow-files/configure-docker.sh ${{ secrets.DINAR_TOKEN }}
cat <<- EOF > REPO/.DINAR/image/.netrc
machine github.com
login $GITHUB_ACTOR
password ${{ secrets.DINAR_TOKEN }}
EOF
- name: Build ${{ env.IMAGE_ODOO_BASE }}
uses: elgohr/Publish-Docker-Github-Action@v4
env:
LOCAL_CUSTOM_DIR: ./image
AGGREGATE: true
PIP_INSTALL_ODOO: false
CLEAN: false
COMPILE: false
with:
name: ${{ env.IMAGE_ODOO_BASE }}
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
buildargs: ODOO_VERSION,AGGREGATE,PIP_INSTALL_ODOO,CLEAN,COMPILE,LOCAL_CUSTOM_DIR
workdir: REPO/.DINAR/
- name: Install python tools
run: |
pip install plumbum pyyaml
- name: Compute Modules Dependencies
run: |
# sets environment variables that available in next steps via $ {{ env.VAR_NAME }} notation
cd REPO
python ../DINAR/workflow-files/analyze-modules.py all
- name: Install Base Addons
run: |
export MODULES=$ALL_MODULES_DEPENDENCIES
export DOODBA_WITHOUT_DEMO=all
bash DINAR/workflow-files/images-with-preinstalled-modules.sh $IMAGE_DB-nodemo $IMAGE_ODOO-nodemo
export DOODBA_WITHOUT_DEMO=false
bash DINAR/workflow-files/images-with-preinstalled-modules.sh $IMAGE_DB $IMAGE_ODOO