Skip to content

Commit d06e617

Browse files
committed
Update Output
1 parent 2e3891b commit d06e617

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/main.sh

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,33 @@
22

33
set -e
44

5-
#echo "🏳️ Starting Stack Deploy Action"
6-
75
function cleanup_trap() {
86
_ST="$?"
97
if [[ "${_ST}" != "0" ]]; then
10-
echo -e "\u001b[31;1mScript Exited with Error: ${_ST}"
8+
echo -e "⚠️ \u001b[33;1mScript Exited with Error: ${_ST}"
119
fi
1210
if [ -z "${INPUT_SSH_KEY}" ];then
13-
echo -e "\u001b[35mCleaning Up authorized_keys on: ${INPUT_HOST}"
11+
echo -e "Cleaning Up authorized_keys on: \u001b[36;1m${INPUT_HOST}"
1412
ssh -p "${INPUT_PORT}" "${INPUT_USER}@${INPUT_HOST}" \
1513
"sed -i '/docker-stack-deploy-action/d' ~/.ssh/authorized_keys"
1614
fi
1715
if [[ "${_ST}" == "0" ]]; then
18-
echo -e "\u001b[32;1mFinished Success."
16+
echo -e "\u001b[32;1mFinished Success."
1917
fi
2018
exit "${_ST}"
2119
}
2220

23-
24-
2521
echo "::group::Starting Stack Deploy Action"
2622
echo "User: $(whoami)"
2723
echo "Script: ${0}"
2824
echo "Directory: $(pwd)"
29-
3025
mkdir -p /root/.ssh
3126
chmod 0700 /root/.ssh
3227
ssh-keyscan -p "${INPUT_PORT}" -H "${INPUT_HOST}" >> /root/.ssh/known_hosts
33-
3428
echo "::endgroup::"
3529

3630
if [ -z "${INPUT_SSH_KEY}" ];then
37-
echo -e "::group::\u001b[36mCreating and Copying SSH Key to: ${INPUT_HOST}"
31+
echo -e "::group::Creating and Copying SSH Key to: \u001b[36;1m${INPUT_HOST}"
3832
ssh-keygen -q -f /root/.ssh/id_rsa -N "" -C "docker-stack-deploy-action"
3933
eval "$(ssh-agent -s)"
4034
ssh-add /root/.ssh/id_rsa
@@ -43,30 +37,28 @@ if [ -z "${INPUT_SSH_KEY}" ];then
4337
ssh-copy-id -p "${INPUT_PORT}" -i /root/.ssh/id_rsa \
4438
"${INPUT_USER}@${INPUT_HOST}"
4539
else
46-
echo -e "::group::\u001b[36mAdding SSH Key to SSH Agent"
40+
echo -e "::group::Adding SSH Key to SSH Agent"
4741
echo "${INPUT_SSH_KEY}" > /root/.ssh/id_rsa
4842
chmod 0600 /root/.ssh/id_rsa
4943
eval "$(ssh-agent -s)"
5044
ssh-add /root/.ssh/id_rsa
5145
fi
52-
5346
echo "::endgroup::"
5447

5548
trap cleanup_trap EXIT HUP INT QUIT PIPE TERM
5649

57-
echo -e "::group::\u001b[36mVerifying Docker and Setting Context."
50+
echo -e "::group::Verifying Docker and Setting Context."
5851
ssh -p "${INPUT_PORT}" "${INPUT_USER}@${INPUT_HOST}" "docker info" > /dev/null
5952

6053
if ! docker context inspect remote >/dev/null 2>&1;then
6154
docker context create remote --docker "host=ssh://${INPUT_USER}@${INPUT_HOST}:${INPUT_PORT}"
6255
fi
6356
docker context use remote
6457
docker context ls
65-
6658
echo "::endgroup::"
6759

6860
if [ -n "${INPUT_ENV_FILE}" ];then
69-
echo -e "\u001b[36mSourcing Environment File: \u001b[37;1m${INPUT_ENV_FILE}"
61+
echo -e "Sourcing Environment File: \u001b[36;1m${INPUT_ENV_FILE}"
7062
stat "${INPUT_ENV_FILE}"
7163
set -a
7264
# shellcheck disable=SC1090
@@ -76,14 +68,14 @@ if [ -n "${INPUT_ENV_FILE}" ];then
7668
fi
7769

7870
if [[ -n "${INPUT_REGISTRY_USER}" && -n "${INPUT_REGISTRY_PASS}" ]];then
79-
echo -e "::group::\u001b[36mLogging in to Registry: \u001b[0m${INPUT_REGISTRY_HOST:-Docker Hub}"
71+
echo -e "::group::Logging in to Registry: \u001b[36;1m${INPUT_REGISTRY_HOST:-Docker Hub}"
8072
echo "${INPUT_REGISTRY_PASS}" |
8173
docker login --username "${INPUT_REGISTRY_USER}" --password-stdin "${INPUT_REGISTRY_HOST}"
8274
INPUT_REGISTRY_AUTH="true"
8375
echo "::endgroup::"
8476
fi
8577

86-
echo -e "::group::\u001b[36mDeploying Stack: \u001b[0m${INPUT_NAME}"
78+
echo -e "::group::Deploying Stack: \u001b[36;1m${INPUT_NAME}"
8779

8880
EXTRA_ARGS=()
8981
if [[ -n "${INPUT_REGISTRY_AUTH}" ]];then

0 commit comments

Comments
 (0)