#!/usr/bin/env bash
set -Eeuo pipefail

# Always operate from this script's own directory so the relative call to
# cpanel-deploy.sh resolves regardless of where deploy.sh is invoked from.
cd /home/neurapyc/repositories/vp_speech
echo `pwd`
git pull origin main
/bin/bash ./scripts/cpanel-deploy.sh

# Publish the current Unity WebGL build (relinks public/<version> + ServerData/WebGL
# from scripts/latestwebglversion.txt). Non-fatal: a missing/unuploaded build must
# not break the app deploy.
/bin/bash ./scripts/webgl-deploy.sh || echo "WARNING: webgl-deploy.sh failed — WebGL links not updated (is the build uploaded?)"