| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This action sets up a PostgreSQL server for the rest of the job. Here are some key features:
| Key | Value | Default |
|---|---|---|
| username | The username of the user to setup. | postgres |
| password | The password of the user to setup. | postgres |
| database | The database name to setup and grant permissions to created user. | postgres |
| port | The server port to listen on. | 5432 |
| postgres-version | The PostgreSQL major version to install. Supported values: "14", "15", "16", "17", "18". | 18 |
| Key | Description | Example |
|---|---|---|
| connection-uri | The connection URI to connect to PostgreSQL. | postgresql://postgres:postgres@localhost/postgres |
| service-name | The service name with connection parameters. | postgres |
| certificate-path | The path to the server certificate if SSL is on. | /home/runner/work/_temp/pgdata/server.crt |
| Key | Value |
|---|---|
| usesuper | true |
| usecreatedb | true |
Important
In order to connect to a PostgreSQL server, either use connection parameters directly (see basic example), or, preferably, obtain a connection URI from the connection-uri output (see recommended example).
Tip
For libpq-based applications, such as PostgreSQL client applications, set the PGSERVICE=postgres environment variable to automatically use the correct connection parameters (see example). The postgres value corresponds to the service name from the service-name output.
steps:
- uses: ikalnytskyi/action-setup-postgres@v8
- run: psql postgresql://postgres:postgres@localhost:5432/postgres -c "SELECT 1"
- run: psql service=postgres -c "SELECT 1"
- run: psql -c "SELECT 1"
env:
PGSERVICE: postgressteps:
- uses: ikalnytskyi/action-setup-postgres@v8
id: postgres
- run: psql ${{ steps.postgres.outputs.connection-uri }} -c "SELECT 1"
- run: psql service=${{ steps.postgres.outputs.service-name }} -c "SELECT 1"
- run: psql -c "SELECT 1"
env:
PGSERVICE: ${{ steps.postgres.outputs.service-name }}steps:
- uses: ikalnytskyi/action-setup-postgres@v8
with:
username: ci
password: sw0rdfish
database: test
port: 34837
postgres-version: "14"
ssl: true
id: postgres
- run: psql ${{ steps.postgres.outputs.connection-uri }} -c "SELECT 1"
- run: psql service=${{ steps.postgres.outputs.service-name }} -c "SELECT 1"
- run: psql -c "SELECT 1"
env:
PGSERVICE: ${{ steps.postgres.outputs.service-name }}steps:
- uses: ikalnytskyi/action-setup-postgres@v8
id: postgres
- env:
PGSERVICE: "${{ steps.postgres.outputs.service-name }}"
run: |
createuser myuser
createdb --owner myuser mydatabase
psql -c "ALTER USER myuser WITH PASSWORD 'mypassword'"At the time of developing there were no GitHub Actions on the marketplace to setup a PostgreSQL server on Linux, Windows and macOS action runners. Most solutions suggest using Docker which is not available on macOS and Windows runners.
The scripts and documentation in this project are released under the MIT License.
| Back | FazBrowse Home | New Git URL |