fix: rm binary before scp to bypass ownership restriction
Some checks failed
BotServer CI / build (push) Has been cancelled

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-03-20 20:59:20 -03:00
parent 97e9e6626e
commit 9f6499b56a

View file

@ -68,13 +68,13 @@ jobs:
working-directory: workspace
run: |
set +e
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 pragmatismo-system "pkill -f /opt/gbo/bin/botserver; sleep 2" 2>&1 | tee /tmp/deploy.log
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 pragmatismo-system "pkill -f /opt/gbo/bin/botserver; sleep 2; rm -f /opt/gbo/bin/botserver" 2>&1 | tee /tmp/deploy.log
echo "--- scp start ---" >> /tmp/deploy.log
scp -o StrictHostKeyChecking=no target/debug/botserver pragmatismo-system:/opt/gbo/bin/botserver 2>&1 | tee -a /tmp/deploy.log
SCP_EXIT=${PIPESTATUS[0]}
echo "scp exit: $SCP_EXIT" >> /tmp/deploy.log
if [ "$SCP_EXIT" = "0" ]; then
ssh -o StrictHostKeyChecking=no pragmatismo-system "chmod +x /opt/gbo/bin/botserver && cd /opt/gbo/bin && nohup sudo -u gbuser ./botserver --noconsole >> /opt/gbo/logs/error.log 2>&1 &" 2>&1 | tee -a /tmp/deploy.log
ssh -o StrictHostKeyChecking=no pragmatismo-system "chmod +x /opt/gbo/bin/botserver && chown gbuser:gbuser /opt/gbo/bin/botserver && cd /opt/gbo/bin && nohup sudo -u gbuser ./botserver --noconsole >> /opt/gbo/logs/error.log 2>&1 &" 2>&1 | tee -a /tmp/deploy.log
fi
- name: Save deploy log