forked from bekriebel/balena-cli-action
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·33 lines (27 loc) · 810 Bytes
/
entrypoint.sh
File metadata and controls
executable file
·33 lines (27 loc) · 810 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
#!/bin/bash
set -e
# Swith to given paths
if [ -d "${GITHUB_WORKSPACE}" ]; then
cd "${GITHUB_WORKSPACE}"
fi
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
# Write secrets file if provided
if [[ "${INPUT_BALENA_SECRETS}" != "" ]]; then
mkdir -p ~/.balena/
echo "${INPUT_BALENA_SECRETS}" > ~/.balena/secrets.json
fi
# Add openBalena redirection if requested
if [[ "${INPUT_BALENA_URL}" != "" ]]; then
echo "balenaUrl: ${INPUT_BALENA_URL}" > ~/.balenarc.yml
fi
# Log in to Balena
balena login --token "${INPUT_BALENA_API_TOKEN}" > /dev/null
# Run command
balena $*