Create deploy.yml #1
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: Deploy to Ubuntu SSH Server | |
on: | |
push: | |
branches: | |
- production # Change this to your main branch | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan -t rsa 13.233.141.245 >> ~/.ssh/known_hosts | |
chmod 644 ~/.ssh/known_hosts | |
- name: Deploy code | |
run: | | |
ssh ubuntu@13.233.141.245 'cd /home/ubuntu/campus-nightpass && git remote set-url origin pancham1603:${{ secrets.GH_TOKEN }}@github.com/pancham1603/campus-nightpass.git && git pull origin production && git remote set-url origin https://github.com/pancham1603/campus-nightpass' |