Skip to content

Commit 364bb2f

Browse files
committed
Initial commit
0 parents  commit 364bb2f

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM docker:stable
2+
3+
COPY entrypoint.sh /entrypoint.sh
4+
RUN chmod +x /entrypoint.sh
5+
ENTRYPOINT ["/entrypoint.sh"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Harmon
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# PostgreSQL GitHub Action
2+
3+
This [GitHub Action](https://github.com/features/actions) sets up a PostgreSQL database.
4+
5+
# Usage
6+
7+
See [action.yml](action.yml)
8+
9+
Basic:
10+
```yaml
11+
steps:
12+
- uses: harmon758/postgresql-action@master
13+
with:
14+
postgresql version: '11' # See https://hub.docker.com/_/postgres for available versions
15+
```
16+
17+
# License
18+
19+
The scripts and documentation in this project are released under the [MIT License](LICENSE)

action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Setup PostgreSQL'
2+
description: 'Setup a PostgreSQL database'
3+
author: 'Harmon'
4+
inputs:
5+
# See https://hub.docker.com/_/postgres for supported versions
6+
# and further details on input environment variables
7+
postgresql version:
8+
description: 'Version of PostgreSQL to use'
9+
required: false
10+
default: 'latest'
11+
postgresql db:
12+
description: 'POSTGRES_DB - name for the default database that is created'
13+
required: false
14+
default: ''
15+
postgresql user:
16+
description: 'POSTGRES_USER - create the specified user with superuser power'
17+
required: false
18+
default: ''
19+
postgresql password:
20+
description: 'POSTGRES_PASSWORD - superuser password'
21+
required: false
22+
default: ''
23+
runs:
24+
using: 'docker'
25+
image: 'Dockerfile'

entrypoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
docker_run="docker run"
4+
docker_run="$docker_run -e POSTGRES_DB=$INPUT_POSTGRESQL_DB"
5+
docker_run="$docker_run -e POSTGRES_USER=$INPUT_POSTGRESQL_USER"
6+
docker_run="$docker_run -e POSTGRES_PASSWORD=$INPUT_POSTGRESQL_PASSWORD"
7+
docker_run="$docker_run -d -p 5432:5432 postgres:$INPUT_POSTGRESQL_VERSION"
8+
9+
sh -c "$docker_run"

0 commit comments

Comments
 (0)