-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yaml
65 lines (61 loc) · 1.68 KB
/
action.yaml
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
61
62
63
64
65
name: emilpriver/geni
description: Migrate your migrations using geni
branding:
icon: database
color: green
author: emilpriver
inputs:
migrations_folder:
required: false
default: "./migrations"
wait_timeout:
required: false
default: "30"
migrations_table:
required: false
default: ""
database_url:
required: true
database_token:
default: ""
required: false
runs:
using: "composite"
steps:
- name: Migrate using Geni
run: |
USER_REPO="emilpriver/geni"
LATEST_TAG=$(curl -s https://api.github.com/repos/$USER_REPO/releases/latest | grep 'tag_name' | cut -d '"' -f 4)
OS="$(uname -s)"
case "$OS" in
Linux*)
OS_TYPE='linux'
BINARY_SUFFIX='linux-amd64'
;;
Darwin*)
OS_TYPE='macos'
BINARY_SUFFIX='macos-amd64'
;;
CYGWIN* | MINGW32* | MSYS* | MINGW*)
OS_TYPE='windows'
BINARY_SUFFIX='windows-amd64'
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
DOWNLOAD_URL="https://github.com/$USER_REPO/releases/download/$LATEST_TAG/geni-$BINARY_SUFFIX"
curl -L $DOWNLOAD_URL -o geni_binary
if [ "$OS_TYPE" != "windows" ]; then
chmod +x geni_binary
fi
./geni_binary up
shell: bash
env:
DATABASE_MIGRATIONS_FOLDER: ${{ inputs.migrations_folder }}
DATABASE_URL: ${{ inputs.database_url }}
DATABASE_TOKEN: ${{inputs.database_token}}
DATABASE_WAIT_TIMEOUT: ${{inputs.wait_timeout}}
DATABASE_NO_DUMP_SCHEMA: "false"
DATABASE_MIGRATIONS_TABLE: ${{inputs.migrations_table}}