OpenG2P Odoo Package Dockers build #359
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |