forked from Theia-Scientific/balena-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·35 lines (28 loc) · 856 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·35 lines (28 loc) · 856 Bytes
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
#!/bin/bash
set -e
# Switch to Workspace path
if [ -d "${GITHUB_WORKSPACE}" ]; then
cd ${GITHUB_WORKSPACE}
fi
# Switch to Application path
if [ -d "${INPUT_APPLICATION_PATH}" ]; then
cd ${INPUT_APPLICATION_PATH}
fi
# Error out of no API Token is available
if [[ "${INPUT_BALENA_API_TOKEN}" == "" ]]; then
echo "Error: Please set the environment variable INPUT_BALENA_API_TOKEN with a Balena API token"
exit 1
fi
# Use Alternative environment if provided
if [[ "${INPUT_BALENA_URL}" != "" ]]; then
echo "balenaUrl: '${INPUT_BALENA_URL}'" >~/.balenarc.yml
fi
# Write secrets file if provided
if [[ "${INPUT_BALENA_SECRETS}" != "" ]]; then
mkdir -p ~/.balena/
echo ${INPUT_BALENA_SECRETS} >~/.balena/secrets.json
fi
# Log in to Balena
/app/balena-cli/balena login --token ${INPUT_BALENA_API_TOKEN}
# Run command
/app/balena-cli/balena $*