name: Deploy Vault CMS on: push: branches: - master jobs: deploy: runs-on: ubuntu-latest container: volumes: - /opt:/opt steps: - name: Deploy shell: bash run: | set -e cd /opt/owicms-src # Force the checkout to match the remote exactly, discarding any # local modifications (a plain pull can keep or merge tampered files) git fetch origin git reset --hard origin/master cd /opt/owicms # Clean up afterwards whether or not the deploy succeeds; otherwise # every failed build leaves its layers behind until the disk fills. # Build cache used in the last day is kept, so routine deploys stay fast. cleanup() { docker image prune -f || true docker builder prune -af --filter until=24h || true } trap cleanup EXIT # Start from a clean slate too, in case an earlier run was killed. cleanup echo "Disk before build:" df -h /opt || true docker system df || true docker compose up -d --build