Merge pull request #92 from Sandile-Dev01/sandile-dev01 #203
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 Production | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
prod: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install SSH Key. | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.PROD_SSH_KEY }} | |
known_hosts: 'just-a-placeholder-so-we-dont-get-errors' | |
- name: Adding our IP to known hosts. | |
run: ssh-keyscan -p ${{ secrets.PROD_SSH_PORT }} -H ${{ secrets.PROD_SSH_IP }} >> ~/.ssh/known_hosts | |
- name: Restart service that automatically pulls from Git and deploys application in Docker container via Docker Compose (started with deaconn systemctl service). | |
run: ssh ${{ secrets.PROD_SSH_USER }}@${{ secrets.PROD_SSH_IP }} -p ${{ secrets.PROD_SSH_PORT }} sudo systemctl restart deaconn | |