Skip to content

Deploy to prod server #47

Deploy to prod server

Deploy to prod server #47

Workflow file for this run

name: Deploy to prod server
on:
workflow_run:
workflows: ["Django tests"]
types:
- completed
branches:
- main
jobs:
deploy_prod:
name: Deploy to prod server
runs-on: ubuntu-latest
environment: deployment
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: install ssh keys
# check this thread to understand why its needed:
# https://stackoverflow.com/a/70447517
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
- name: connect and pull
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "./update.sh && exit"
- name: cleanup
run: rm -rf ~/.ssh