@@ -21,6 +21,10 @@ inputs:
2121 description : The server port to listen on.
2222 default : " 5432"
2323 required : false
24+ postgres-version :
25+ description : The PostgreSQL (major) version to install.
26+ default : " 15"
27+ required : false
2428outputs :
2529 connection-uri :
2630 description : The connection URI to connect to PostgreSQL.
@@ -31,13 +35,25 @@ outputs:
3135runs :
3236 using : composite
3337 steps :
34- - name : Prerequisites
38+ - name : Install PostgreSQL
3539 run : |
3640 if [ "$RUNNER_OS" == "Linux" ]; then
37- echo "$(pg_config --bindir)" >> $GITHUB_PATH
41+ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
42+ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
43+ sudo apt-get update
44+ sudo apt-get -y install postgresql-${{ inputs.postgres-version }}
45+
46+ echo "$(/usr/lib/postgresql/${{ inputs.postgres-version }}/bin/pg_config --bindir)" >> $GITHUB_PATH
47+
3848 elif [ "$RUNNER_OS" == "Windows" ]; then
39- echo "$PGBIN" >> $GITHUB_PATH
40- echo "PQ_LIB_DIR=$PGROOT\lib" >> $GITHUB_ENV
49+ choco install postgresql${{ inputs.postgres-version }}
50+
51+ echo "$('C:/Program Files/PostgreSQL/${{ inputs.postgres-version }}/bin/pg_config.exe' --bindir)" >> $GITHUB_PATH
52+ echo "PQ_LIB_DIR=$('C:/Program Files/PostgreSQL/${{ inputs.postgres-version }}/bin/pg_config.exe' --libdir)" >> $GITHUB_ENV
53+
54+ elif [ "$RUNNER_OS" == "macOS" ]; then
55+ brew install postgresql@${{ inputs.postgres-version }}
56+ brew link --overwrite postgresql@${{ inputs.postgres-version }}
4157 fi
4258 shell : bash
4359
6581 --pwfile="$PWFILE" \
6682 --auth="scram-sha-256" \
6783 --encoding="UTF-8" \
68- --locale="en_US.UTF-8" \
69- --no-instructions
84+ --locale="en_US.UTF-8"
7085
7186 # Do not create unix sockets since they are created by default in the
7287 # directory we have no permissions to (owned by system postgres user).
0 commit comments