File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,26 +38,24 @@ jobs:
3838 env :
3939 PRIVATE_KEY : ${{ secrets.PROD_SERVER_KEY }}
4040 HOST : ${{ secrets.PROD_SERVER_HOST }}
41- USER : ${{ secrets.SERVER_USERNAME }}
41+ REMOTE_USER : ${{ secrets.SERVER_USERNAME }}
4242 IMAGE_TAG : ${{ steps.vars.outputs.sha_short }}
4343 run : |
44- # Setup SSH directory
4544 mkdir -p ~/.ssh
4645 chmod 700 ~/.ssh
47-
48- # Save the Private Key to a file using the env var
49- echo "$PRIVATE_KEY" > ~/.ssh/id_rsa
46+
47+ # Using printf instead of echo prevents newline formatting bugs
48+ printf "%s\n" "$PRIVATE_KEY" > ~/.ssh/id_rsa
5049 chmod 600 ~/.ssh/id_rsa
51-
52- # Add the server to known_hosts to avoid prompt
50+
5351 ssh-keyscan -H "$HOST" >> ~/.ssh/known_hosts
54-
55- # Run the remote commands
56- ssh -i ~/.ssh/id_rsa "$USER @$HOST" "
52+
53+ # Added -v for debugging, -o for RSA support, and $REMOTE_USER
54+ ssh -v -o PubkeyAcceptedKeyTypes=+ssh-rsa - i ~/.ssh/id_rsa "$REMOTE_USER @$HOST" "
5755 export IMAGE_TAG=$IMAGE_TAG
5856 cd docker-compose
5957 docker stack rm thestack
6058 sleep 20
6159 docker stack deploy -c docker-compose.yml thestack
6260 docker system prune -af
63- "
61+ "
You can’t perform that action at this time.
0 commit comments