diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 2957e94..48af1c7 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -28,8 +28,9 @@ jobs: run: | APP_DIR=/home/tyler/route-commerce mkdir -p $APP_DIR - # Seed .env.example into APP_DIR if missing (it lives in the repo, not in APP_DIR) + # Seed config files into APP_DIR if missing (they live in the repo, not in APP_DIR) [ -f $APP_DIR/.env.example ] || cp .env.example $APP_DIR/.env.example + [ -f $APP_DIR/docker-compose.yml ] || cp docker-compose.yml $APP_DIR/docker-compose.yml cd $APP_DIR [ -f .env ] || cp .env.example .env # Append production secrets to .env (overriding .env.example defaults) @@ -57,7 +58,11 @@ jobs: POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} POSTGRES_DB: ${{ secrets.POSTGRES_DB }} run: | - cd /home/tyler/route-commerce + APP_DIR=/home/tyler/route-commerce + # Seed supabase/ into APP_DIR if missing (the deploy step copies it after, but + # we need it here for migrations) + [ -d $APP_DIR/supabase ] || cp -r supabase $APP_DIR/supabase + cd $APP_DIR PGPASSWORD="${POSTGRES_PASSWORD}" psql -h 127.0.0.1 -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -v ON_ERROR_STOP=0 -f supabase/migrations/000_preflight_supabase_compat.sql || true [ -f supabase/captured_schema.sql ] && PGPASSWORD="${POSTGRES_PASSWORD}" psql -h 127.0.0.1 -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" -v ON_ERROR_STOP=0 -f supabase/captured_schema.sql || echo "captured_schema.sql not present, skipping" for f in supabase/migrations/[0-9]*.sql; do