File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -61,18 +61,20 @@ jobs:
6161 SSH_USER : ${{ secrets.SSH_USER }}
6262 SSH_KEY : ${{ secrets.SSH_KEY }} # SSH private key stored as a GitHub secret
6363 SSH_WEB_PATH : ${{ secrets.SSH_WEB_PATH }}
64+ BRANCH_NAME : ${{ github.ref_name }}
6465 run : |
6566 # Save the private key for SSH
6667 mkdir -p ~/.ssh
67- echo "$SSH_KEY" > "~/.ssh/id_$SSH_USER"
68- chmod 600 "~/.ssh/id_$SSH_USER"
68+ echo "${ SSH_KEY} " > "~/.ssh/id_${ SSH_USER} "
69+ chmod 600 "~/.ssh/id_${ SSH_USER} "
6970
70- # Copy the artifact to the VPS
71- scp -i "~/.ssh/id_$SSH_USER" -P "$SSH_PORT" project.zip "$SSH_USER@$ SSH_HOST:${SSH_WEB_PATH:. }"
71+ # Copy the artifact to the Remote
72+ scp -i "~/.ssh/id_${ SSH_USER} " -P "${ SSH_PORT} " project.zip "${ SSH_USER}@${ SSH_HOST} :${SSH_WEB_PATH}/${BRANCH_NAME }"
7273
73- # Connect to the VPS and unzip the project
74- ssh -i "~/.ssh/id_$SSH_USER" -p "$SSH_PORT" "$SSH_USER@$SSH_HOST" << 'EOF'
75- cd ${SSH_WEB_PATH:.}/
74+ # Connect to the Remote and unzip the project
75+ ssh -i "~/.ssh/id_${SSH_USER}" -p "${SSH_PORT}" "${SSH_USER}@${SSH_HOST}" << EOF
76+ mkdir -p ${SSH_WEB_PATH}/${BRANCH_NAME}
77+ cd ${SSH_WEB_PATH}/${BRANCH_NAME}
7678 unzip ./project.zip
7779 rm ./project.zip
7880 EOF
You can’t perform that action at this time.
0 commit comments