hms_bak/.gitea/workflows/workflows.yaml
gitea 464e155f98
All checks were successful
Update odoo 18 / update (push) Successful in 35s
Update .gitea/workflows/workflows.yaml
2024-11-16 18:10:29 +04:00

42 lines
1.5 KiB
YAML

name: Update odoo 18
run-name: ${{ gitea.actor }} is testing out Gitea Actions
on:
push:
branches:
- dev
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: Checkout code on server and restart stacks
uses: appleboy/ssh-action@v1.1.0
with:
host: ${{ secrets.SERVER_SSH_HOST }}
username: ${{ secrets.SERVER_SSH_USER }}
password: ${{ secrets.SERVER_SSH_PASSWORD }}
port: ${{ secrets.SERVER_SSH_PORT }}
script: |
cd /home/sysop/odoo18/customaddons/bross_hms
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/')
if [ -z "${modules_to_update}" ]; then
echo "No module to update"
else
git pull
args="-d bross_hms_dev -u ${modules_to_update}"
docker compose -f compose_dev.yaml down
export ARGS='${args}' && docker compose -f compose_dev.yaml up -d
fi