Skip to content

OpenG2P Odoo Package Dockers build #263

OpenG2P Odoo Package Dockers build

OpenG2P Odoo Package Dockers build #263

name: OpenG2P Odoo Package Dockers build
on:
workflow_dispatch:
inputs:
packageName:
description: 'Package Name'
required: true
default: 'pbms/17.0-develop'
type: choice
options:
- pbms/*
- pbms/15.0-develop
- pbms/15.0-develop-pilot001
- pbms/15.0-ugc-demo
- pbms/15.0-1.1.0
- pbms/1.1.0
- pbms/17.0-develop-with-social-registry
- pbms/17.0-develop
- social-registry/*
- social-registry/17.0-develop
- social-registry/1.2.0
- social-registry/1.2.1
- social-registry/1.2.2
- social-registry/1.2.3
- social-registry/1.3.0
- social-registry/1.3.1
- social-registry/1.2
- social-registry/1.3
- ati-social-registry/1.3.0
- ati-social-registry/1.3.1
- ati-social-registry/1.3
- ati-social-registry/17.0-develop
- mowsa-social-registry/1.3-develop
- mowsa-social-registry/1.3.0
- mowsa-social-registry/1.3.1
- edrmc-social-registry/1.3.0
- drms-social-registry/1.3.0
jobs:
docker-build:
runs-on: ubuntu-latest
env:
NAMESPACE: ${{ secrets.docker_hub_organisation }}
PBMS_DOCKER_IMAGE_NAME: openg2p-pbms-odoo-package
SOCIAL_REGISTRY_DOCKER_IMAGE_NAME: openg2p-social-registry-odoo-package
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
packageNameInput=${{ inputs.packageName }}
if [ ! -f "packages/${packageNameInput}.txt" ]; then
echo "Could not find the package specified." 1>&2;
exit 1;
fi
for package in packages/${packageNameInput}.txt; do
export IMAGE_ID=$(sed -n '1p' $package)
if [[ $IMAGE_ID == "#!"* ]]; then
export IMAGE_ID=${IMAGE_ID#"#!"}
else
export DOCKER_TAG=$(basename "${package}" ".txt")
if [[ $packageNameInput == pbms* ]]; then
export IMAGE_ID=$NAMESPACE/$PBMS_DOCKER_IMAGE_NAME:$DOCKER_TAG
elif [[ $packageNameInput == social-registry* ]]; then
export IMAGE_ID=$NAMESPACE/$SOCIAL_REGISTRY_DOCKER_IMAGE_NAME:$DOCKER_TAG
fi
fi
export ODOO_BASE_VERSION=$(sed -n '2p' $package)
export ODOO_BASE_VERSION=${ODOO_BASE_VERSION#"#!"}
./package.sh ${package}
docker build . \
--build-arg BASE_VERSION=${ODOO_BASE_VERSION} \
--file Dockerfile \
--tag $IMAGE_ID
docker push $IMAGE_ID
done