Skip to content

Commit 6ff2f3d

Browse files
committed
check pg version in macos runner
1 parent ed45ebb commit 6ff2f3d

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

action.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,27 @@ runs:
7070
sudo apt-get install postgresql-$PG_VERSION-postgis-3
7171
shell: bash
7272

73+
- name: Check PostgreSQL version (macOS)
74+
if: runner.os == 'macOS'
75+
id: pg-version-mac
76+
shell: bash
77+
run: |
78+
# Check if PostgreSQL service is running via Homebrew
79+
PG_SERVICE=$(brew services list | grep postgresql | grep started || true)
80+
if [ -z "$PG_SERVICE" ]; then
81+
echo "Error: No PostgreSQL service is running via Homebrew"
82+
exit 1
83+
fi
84+
85+
# Extract the formula name from service info
86+
PG_FORMULA=$(echo "$PG_SERVICE" | awk '{print $1}')
87+
# Extract version number from formula (e.g., postgresql@14 -> 14)
88+
PG_VERSION=$(echo "$PG_FORMULA" | cut -d@ -f2)
89+
echo "Found running PostgreSQL service: $PG_FORMULA (version $PG_VERSION)"
90+
91+
# Output version for next steps
92+
echo "version=$PG_VERSION" >> $GITHUB_OUTPUT
93+
7394
- name: Install PostGIS on macOS
7495
if: runner.os == 'macOS'
7596
shell: bash

0 commit comments

Comments
 (0)