Skip to content

Commit 1b2b631

Browse files
committed
Use HOME variable
1 parent 6844f58 commit 1b2b631

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.github/workflows/deployment.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,23 @@ jobs:
6464
BRANCH_NAME: ${{ github.ref_name }}
6565
run: |
6666
#!/usr/bin/env bash
67-
6867
set -ex -o pipefail
6968
7069
# Save the private key for SSH
71-
mkdir -pv ~/.ssh
72-
echo "${SSH_KEY}" > "~/.ssh/id_${SSH_USER}"
73-
chmod -v 400 "~/.ssh/id_${SSH_USER}"
70+
mkdir -pv "${HOME}/.ssh"
71+
echo "${SSH_KEY}" > "${HOME}/.ssh/id_${SSH_USER}"
72+
chmod -v 400 "${HOME}/.ssh/id_${SSH_USER}"
7473
7574
# Copy the artifact to the Remote
76-
scp -i "~/.ssh/id_${SSH_USER}" -P "${SSH_PORT}" project.zip "${SSH_USER}@${SSH_HOST}:${SSH_WEB_PATH}/${BRANCH_NAME}"
75+
scp -i "${HOME}/.ssh/id_${SSH_USER}" -P "${SSH_PORT}" project.zip "${SSH_USER}@${SSH_HOST}:${SSH_WEB_PATH}/${BRANCH_NAME}"
7776
7877
# Connect to the Remote and unzip the project
79-
ssh -i "~/.ssh/id_${SSH_USER}" -p "${SSH_PORT}" "${SSH_USER}@${SSH_HOST}" << EOF
78+
ssh -i "${HOME}/.ssh/id_${SSH_USER}" -p "${SSH_PORT}" "${SSH_USER}@${SSH_HOST}" << EOF
8079
mkdir -p ${SSH_WEB_PATH}/${BRANCH_NAME}
8180
cd ${SSH_WEB_PATH}/${BRANCH_NAME}
8281
unzip ./project.zip
8382
rm ./project.zip
8483
EOF
8584
8685
# Cleanup the secret
87-
rm -rfv "~/.ssh/id_${SSH_USER}" "~/.ssh/id_${SSH_USER}.pub"
86+
rm -rfv "${HOME}/.ssh/id_${SSH_USER}" "${HOME}/.ssh/id_${SSH_USER}.pub"

0 commit comments

Comments
 (0)