-
Notifications
You must be signed in to change notification settings - Fork 6
49 lines (41 loc) · 1.52 KB
/
package_docker.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
name: OpenG2P Odoo Package Dockers build
on:
workflow_dispatch:
inputs:
packagePath:
description: 'Package path w.r.t packages folder'
required: true
default: ''
type: string
jobs:
docker-build:
runs-on: ubuntu-latest
env:
OPENG2P_BOT_GITHUB_PAT: ${{ secrets.OPENG2P_BOT_GITHUB_PAT }}
steps:
- uses: actions/checkout@v2
- name: Docker Login
run: |
echo "${{ secrets.docker_hub_token }}" | docker login -u ${{ secrets.docker_hub_actor }} --password-stdin || echo "::warning::Failed to Login to dockerhub"
- name: Docker build & push
run: |
cd packaging/packages
package=${{ inputs.packagePath }}
if [ ! -f ${package} ]; then
echo "Could not find the package specified." 1>&2;
exit 1;
fi
# Pick the Docker name from the first line of the package file
export IMAGE_ID=$(sed -n '1p' $package)
export IMAGE_ID=${IMAGE_ID#"#!"}
# Pick the Odoo version from the second line of the package file
export ODOO_BASE_VERSION=$(sed -n '2p' $package)
export ODOO_BASE_VERSION=${ODOO_BASE_VERSION#"#!"}
cd ../
./package.sh packages/${package}
docker build . \
--build-arg BASE_VERSION=${ODOO_BASE_VERSION} \
--build-arg PACKAGING_REPO_COMMIT_HASH=$(git log -1 --pretty=format:'%H') \
--file Dockerfile \
--tag $IMAGE_ID
docker push $IMAGE_ID