-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
98 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: "postgresql" | ||
description: "stop, clean and start postgresql in order" | ||
inputs: | ||
stop: | ||
description: "whether to stop" | ||
required: true | ||
clean: | ||
description: "whether to clean" | ||
required: true | ||
start: | ||
description: "whether to start" | ||
required: true | ||
username: | ||
description: The username of the user to setup. | ||
default: postgres | ||
required: false | ||
password: | ||
description: The password of the user to setup. | ||
default: postgres | ||
required: false | ||
ports: | ||
description: The server port to listen on. | ||
default: "5432" | ||
required: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- if: fromJSON(inputs.stop) || fromJSON(inputs.clean) | ||
name: unimplemented | ||
shell: bash | ||
run: exit 1 | ||
|
||
- if: fromJSON(inputs.start) | ||
name: Create postgresql Work Directory | ||
shell: bash | ||
working-directory: ${{ github.action_path }} | ||
run: | | ||
for port in ${{ inputs.ports }}; do | ||
mkdir -p $port | ||
done | ||
- if: fromJSON(inputs.start) | ||
name: Start postgresql | ||
shell: bash | ||
working-directory: ${{ github.action_path }} | ||
run: | | ||
for port in ${{ inputs.ports }}; do | ||
PGDATA=${port} | ||
PWFILE=${port}.pgpass | ||
PGCONF=${PGDATA}/postgresql.conf | ||
echo '${{ inputs.password }}' > "${PWFILE}" | ||
initdb \ | ||
--pgdata="${PGDATA}" \ | ||
--username="${{ inputs.username }}" \ | ||
--pwfile="${PWFILE}" \ | ||
--auth="trust" \ | ||
--no-instructions | ||
echo "port = ${port}" >> "${PGCONF}" | ||
echo "unix_socket_directories = ''" >> "${PGCONF}" | ||
echo "fsync = off" >> "${PGCONF}" | ||
pg_ctl start --pgdata="${PGDATA}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.