This repository has been archived by the owner on Sep 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
61 lines (53 loc) · 1.72 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Snaplet Preview Databases
author: Snaplet
description: Deploy Snaplet preview databases filled with production-accurate data in no time.
inputs:
database-create-command:
description: Command used to generate the instant database
required: false
type: string
default: snaplet preview-database create --git --latest
database-delete-command:
description: Command used to delete the instant database
required: false
type: string
default: snaplet preview-database drop --git
database-url-command:
description: Command used to get the instant database url
required: false
type: string
default: snaplet preview-database url --git
delete:
description: Delete the database
required: false
type: boolean
default: false
reset:
description: Reset the database state on each commit
required: false
type: boolean
default: false
outputs:
database-url:
description: Instant database url
value: ${{ steps.deploy.outputs.database-url }}
runs:
using: composite
steps:
- name: Setup
shell: bash
run: curl -sS "https://app.snaplet.dev/get-cli/" | bash &> "/dev/null"
- if: ${{ inputs.delete == 'false' }}
id: deploy
name: Deploy
shell: bash
run: |
if [ "${{ inputs.reset }}" == "true" ]; \
then ${{ inputs.database-delete-command }} && ${{ inputs.database-create-command }}; \
else ${{ inputs.database-url-command }} &> "/dev/null" || ${{ inputs.database-create-command }}; \
fi
echo "database-url=$(${{ inputs.database-url-command }})" >> $GITHUB_OUTPUT
- if: ${{ inputs.delete == 'true' }}
name: Delete
shell: bash
run: ${{ inputs.database-delete-command }}