diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f40b51b..b958e32 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -101,9 +101,15 @@ jobs: echo "✓ Database credentials fetched successfully" - # Install PostgreSQL client - sudo apt-get update - sudo apt-get install -y postgresql-client + # The runner image already ships PostgreSQL (only the service is disabled), so + # psql is normally on PATH. Install only if that stops being true. + if command -v psql > /dev/null; then + psql --version + else + echo "psql not on the runner image; installing" + sudo apt-get update + sudo apt-get install -y --no-install-recommends postgresql-client + fi echo 'loading North American ecoregions into database' psql -c "CREATE SCHEMA IF NOT EXISTS features; DROP TABLE IF EXISTS features.ecoregions;" diff --git a/.github/workflows/reset-data.yml b/.github/workflows/reset-data.yml index 985aefc..56dafa8 100644 --- a/.github/workflows/reset-data.yml +++ b/.github/workflows/reset-data.yml @@ -59,10 +59,19 @@ jobs: fi echo "Confirmed: deleting non-fixture collections from '$PROJECT'." - - name: Install PostgreSQL client + # The ubuntu-24.04 runner image already ships PostgreSQL (only the *service* is + # disabled), so psql is normally on PATH and installing it cost ~9s of `apt-get + # update` for nothing. Kept as a fallback rather than deleted, so this still works + # if a future image drops it. + - name: Ensure psql run: | - sudo apt-get update - sudo apt-get install -y postgresql-client + if command -v psql > /dev/null; then + psql --version + else + echo "psql not on the runner image; installing" + sudo apt-get update + sudo apt-get install -y --no-install-recommends postgresql-client + fi - name: Reset collections env: