junari/odoo Docker Image CI #41
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: junari/odoo Docker Image CI | |
on: | |
workflow_dispatch: | |
jobs: | |
build_upload: | |
runs-on: ubuntu-22.04 | |
outputs: | |
odoo_version: ${{ steps.buildtag.outputs.odoo_version }} | |
buildtag: ${{ steps.buildtag.outputs.buildtag }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set build tag | |
id: buildtag | |
run: | | |
source build.env | |
echo "::set-output name=odoo_version::$ODOO_VERSION" | |
echo "::set-output name=odoo_revision::$ODOO_REVISION" | |
echo "::set-output name=buildtag::$(date '+%Y%m%d')-$ODOO_REVISION" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build & Push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
file: ./Dockerfile | |
build-args: | | |
ODOO_VERSION=${{steps.buildtag.outputs.odoo_version}} | |
ODOO_REVISION=${{steps.buildtag.outputs.odoo_revision}} | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
junari/odoo:${{steps.buildtag.outputs.odoo_version}} | |
junari/odoo:${{steps.buildtag.outputs.odoo_version}}-${{steps.buildtag.outputs.buildtag}} | |
# test_deploy: | |
# needs: build_upload | |
# runs-on: ubuntu-18.04 | |
# services: | |
# postgres: | |
# image: postgres:11 | |
# env: | |
# POSTGRES_PASSWORD: postgres | |
# POSTGRES_USER: postgres | |
# ports: | |
# - 5432:5432 | |
# options: >- | |
# --health-cmd pg_isready | |
# --health-interval 10s | |
# --health-timeout 5s | |
# --health-retries 5 | |
# junariodoo: | |
# image: junari/odoo:${{needs.build_upload.outputs.buildtag}} | |
# volumes: | |
# - junari-odoo-data:/opt/odoo/data | |
# ports: | |
# - 8069:8069 | |
# env: | |
# DB_HOST: postgres | |
# DB_PORT: 5432 | |
# DB_USER: odoo | |
# DB_PASSWORD: odoo | |
# options: --name junariodoo | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Create Postgresql user | |
# run: PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE USER odoo; ALTER ROLE odoo WITH PASSWORD 'odoo';" | |
# - name: Create Odoo database | |
# run: PGPASSWORD=postgres psql -h localhost -U postgres -c "CREATE DATABASE odoo ENCODING 'UTF8';" | |
# - name: Sleep | |
# uses: jakejarvis/wait-action@master | |
# with: | |
# time: '60s' | |
# - name: Check running containers | |
# run: docker ps | |
# - name: Initialise Odoo Container | |
# env: | |
# DB_HOST: postgres | |
# DB_PORT: 5432 | |
# DB_USER: odoo | |
# DB_PASSWORD: odoo | |
# run: docker exec -d junariodoo python3 /opt/odoo/odoo/odoo-bin --db_host=$DB_HOST --db_port=$DB_PORT --db_user=$DB_USER --db_password=$DB_PASSWORD -d odoo -i base --without-demo=all --load-language=en_GB | |
# - name: Test Container is running | |
# run: ./test-container-connection.sh | |
# - name: Login to DockerHub | |
# uses: docker/login-action@v1 | |
# with: | |
# username: ${{ secrets.DOCKER_USERNAME }} | |
# password: ${{ secrets.DOCKER_PASSWORD }} | |
# - name: Tag tested image as latest | |
# run: | | |
# docker tag junari/odoo:${{needs.build_upload.outputs.buildtag}} junari/odoo:latest | |
# docker push junari/odoo:latest |