From 71188a33696b559e7837450c6e901917b6027b59 Mon Sep 17 00:00:00 2001 From: mgite Date: Tue, 29 Oct 2024 16:46:05 +0400 Subject: [PATCH] Add workflow --- .gitea/workflows/workflows.yaml | 52 +++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .gitea/workflows/workflows.yaml diff --git a/.gitea/workflows/workflows.yaml b/.gitea/workflows/workflows.yaml new file mode 100644 index 0000000..bf07026 --- /dev/null +++ b/.gitea/workflows/workflows.yaml @@ -0,0 +1,52 @@ +name: Update odoo 18 +run-name: ${{ gitea.actor }} is testing out Gitea Actions +on: + push: + branches: + - dev + # paths: + # - '**/docker-compose.yml' + # - '**/.env' + +jobs: + update: + runs-on: ubuntu-22.04 + steps: + - name: Setup correct time in build container + run: ln -sf /usr/share/zoneinfo/Asia/Tbilisi /etc/localtime + + - name: Checkout repository + uses: actions/checkout@v4 + with: + github-server-url: http://10.0.0.8:3000 + repository: gitea/bross_hms + token: ${{ secrets.PAT }} + path: . + fetch-depth: 0 + + - name: Deploy to main environment + if: gitea.ref == 'refs/heads/dev' + run: | + ### Get current commit + # commit_hash=$(git rev-parse --short HEAD) + + ### Update local repo + # cd /opt/odoo/extra-addons + # git pull + + ### Get modules list to update + modules_to_update=$(git diff --name-only ${{ gitea.event.before }}..${{ gitea.event.after }} | awk -F/ '{print $1}' | uniq | xargs -I {} sh -c 'find {} -type f -name "__manifest__.py" | grep -q "__manifest__.py" && echo {}' 2>/dev/null | sed -z 's/\n/,/g; s/,$/\n/') + echo $modules_to_update + ### Generate update string + # if [ -z "${modules_to_update}" ]; then + # echo "No module to update" + # # args="-d fms" + # else + # echo "Modules to update set" + # args="-d fms_prod -u ${modules_to_update}" + # docker compose -f /opt/odoo/docker-compose.yml down + # export ADDONS="--addons-path=/opt/odoo/addons/,/mnt/extra-addons/" && export ARGS=${args} && docker compose -f /opt/odoo/docker-compose.yml up -d + # fi + + - name: Install sshpass + run: apt update && apt install -y sshpass