Deploy to dev server #210
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 dev server | |
on: | |
workflow_run: | |
workflows: ["Django tests"] | |
types: | |
- completed | |
branches: | |
- dev | |
jobs: | |
deploy_dev: | |
name: Deploy to dev 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_DEV }}" > ~/.ssh/id_rsa | |
ssh-keyscan -H ${{ secrets.SSH_HOST_DEV }} > ~/.ssh/known_hosts | |
- name: connect and pull | |
run: ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST_DEV }} "sudo ./update.sh && exit" | |
- name: cleanup | |
run: rm -rf ~/.ssh |