Update .gitea/workflows/workflows.yaml
All checks were successful
Update odoo 18 / update (push) Successful in 35s
All checks were successful
Update odoo 18 / update (push) Successful in 35s
This commit is contained in:
parent
36b2a3fab6
commit
464e155f98
@ -4,9 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
# paths:
|
|
||||||
# - '**/docker-compose.yml'
|
|
||||||
# - '**/.env'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
update:
|
||||||
@ -15,9 +12,6 @@ jobs:
|
|||||||
- name: Setup correct time in build container
|
- name: Setup correct time in build container
|
||||||
run: ln -sf /usr/share/zoneinfo/Asia/Tbilisi /etc/localtime
|
run: ln -sf /usr/share/zoneinfo/Asia/Tbilisi /etc/localtime
|
||||||
|
|
||||||
- name: Install sshpass
|
|
||||||
run: apt update && apt install -y sshpass
|
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@ -27,36 +21,22 @@ jobs:
|
|||||||
path: .
|
path: .
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
# - name: Testing
|
- name: Checkout code on server and restart stacks
|
||||||
# run: |
|
uses: appleboy/ssh-action@v1.1.0
|
||||||
# modules_to_update=$(git diff --name-only ${{ gitea.event.before }}..${{ gitea.event.after }} | awk -F/ '{print $1}')
|
with:
|
||||||
# echo $modules_to_update
|
host: ${{ secrets.SERVER_SSH_HOST }}
|
||||||
|
username: ${{ secrets.SERVER_SSH_USER }}
|
||||||
# export SSHPASS=${{ secrets.SERVER_SSH_PASSWORD }}
|
password: ${{ secrets.SERVER_SSH_PASSWORD }}
|
||||||
# export STACK_PATH="/home/sysop/odoo18/customaddons/bross_hms"
|
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/')
|
||||||
|
|
||||||
# sshpass -e ssh -p ${{ secrets.SERVER_SSH_PORT }} -o StrictHostKeyChecking=no \
|
if [ -z "${modules_to_update}" ]; then
|
||||||
# ${{ secrets.SERVER_SSH_USER }}@${{ secrets.SERVER_SSH_HOST }} "echo $modules_to_update > testing_file"
|
echo "No module to update"
|
||||||
|
else
|
||||||
- name: Deploy to dev environment
|
git pull
|
||||||
# if: gitea.ref == 'refs/heads/dev'
|
args="-d bross_hms_dev -u ${modules_to_update}"
|
||||||
run: |
|
docker compose -f compose_dev.yaml down
|
||||||
# export SSHPASS=${{ secrets.SERVER_SSH_PASSWORD }}
|
export ARGS='${args}' && docker compose -f compose_dev.yaml up -d
|
||||||
# export STACK_PATH="/home/sysop/odoo18/customaddons/bross_hms"
|
fi
|
||||||
|
|
||||||
# git config --global --add safe.directory $STACK_PATH
|
|
||||||
|
|
||||||
### 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"
|
|
||||||
# else
|
|
||||||
# echo "Modules to update set"
|
|
||||||
# args="-d bross_hms_dev -u ${modules_to_update}"
|
|
||||||
# sshpass -e ssh -p ${{ secrets.SERVER_SSH_PORT }} -o StrictHostKeyChecking=no \
|
|
||||||
# ${{ secrets.SERVER_SSH_USER }}@${{ secrets.SERVER_SSH_HOST }} \
|
|
||||||
# "cd $STACK_PATH && git pull && docker compose -f compose_dev.yaml down && export ARGS='${args}' && docker compose -f compose_dev.yaml up -d"
|
|
||||||
# fi
|
|
||||||
Loading…
Reference in New Issue
Block a user