Merge pull request #155 from AnkanSaha/dev #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Send Code to VM | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
send-code: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Setup SSH | |
uses: webfactory/ssh-agent@v0.5.3 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Create SSH Private Key File | |
run: | | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key.pem | |
chmod 600 private_key.pem | |
- name: Copy code to VM | |
run: | | |
sudo scp -o StrictHostKeyChecking=no -i private_key.pem -r ./* ${{ secrets.USERNAME }}@${{ secrets.VM_IP }}:~/ # Copies all files and directories to the home directory of the user on VM | |
- name: Clean Up | |
run: | | |
rm private_key.pem |