-
Notifications
You must be signed in to change notification settings - Fork 1
/
entrypoint.sh
executable file
·68 lines (57 loc) · 2.08 KB
/
entrypoint.sh
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
66
67
68
#!/bin/bash
## Because of the docker-in-docker setup for the action we need to set 'localhost' to the host docker IP
echo "172.17.0.1 localhost" > /etc/hosts
if [ -z "$INPUT_PROJECT_DIRECTORY" ]; then
export PROJECT_DIR=$RUNNER_WORKSPACE/${GITHUB_REPOSITORY#*/}
else
export PROJECT_DIR=$RUNNER_WORKSPACE/${GITHUB_REPOSITORY#*/}/$INPUT_PROJECT_DIRECTORY
cd $INPUT_PROJECT_DIRECTORY || exit 1
fi
if [ "$INPUT_TASK" == "init" ]; then
echo "Initializing project..."
taq init
fi
if [ -n "$INPUT_PLUGINS" ]; then
# for each plugin in the comma separated INPUT_PLUGINS install the plugin
for plugin in $(echo $INPUT_PLUGINS | tr "," "\n"); do
echo "Installing plugin $plugin"
taq install $plugin
done
fi
if [ -n "$INPUT_CONTRACTS" ]; then
# for each contract in the comma separated INPUT_CONTRACTS register the contract
for contract in $(echo $INPUT_CONTRACTS | tr "," "\n"); do
echo "Registering contract $contract"
taq add-contract "$contract"
done
fi
if [ -n "$INPUT_COMPILE_CONTRACTS" ]; then
# for each contract in the comma separated INPUT_CONTRACTS register the contract
for contract in $(echo $INPUT_COMPILE_CONTRACTS | tr "," "\n"); do
echo "Compiling $contract"
taq compile "$contract" --plugin "$INPUT_COMPILE_PLUGIN"
done
chmod -R 777 ./artifacts
fi
if [ -n "$INPUT_SANDBOX_NAME" ]; then
taq start sandbox "$INPUT_SANDBOX_NAME"
fi
if [ -n "$INPUT_DEPLOY_CONTRACTS" ]; then
# for each contract in the comma separated INPUT_CONTRACTS register the contract
for contract in $(echo "$INPUT_DEPLOY_CONTRACTS" | tr "," "\n"); do
echo "Deploying $contract"
taq deploy "$contract" --env "$INPUT_ENVIRONMENT"
done
fi
if [ -n "$INPUT_TASK" ] && [ "$INPUT_TASK" != "init" ]; then
echo "Running task: $INPUT_TASK"
taq "$INPUT_TASK"
fi
if [ -n "$INPUT_TEST_PLUGIN" ]; then
chmod -R 777 ./.taq
echo "Running tests using plugin $INPUT_TEST_PLUGIN"
taq test --plugin "$INPUT_TEST_PLUGIN"
exit_code=$?
chmod -R 755 ./.taq
exit $exit_code
fi