File tree 1 file changed +9
-7
lines changed
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -61,18 +61,20 @@ jobs:
61
61
SSH_USER : ${{ secrets.SSH_USER }}
62
62
SSH_KEY : ${{ secrets.SSH_KEY }} # SSH private key stored as a GitHub secret
63
63
SSH_WEB_PATH : ${{ secrets.SSH_WEB_PATH }}
64
+ BRANCH_NAME : ${{ github.ref_name }}
64
65
run : |
65
66
# Save the private key for SSH
66
67
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} "
69
70
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 }"
72
73
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}
76
78
unzip ./project.zip
77
79
rm ./project.zip
78
80
EOF
You can’t perform that action at this time.
0 commit comments