Skip to content

Merge pull request #5 from unicef-drp/feature/826-Remove-Django-Warnings #6

Merge pull request #5 from unicef-drp/feature/826-Remove-Django-Warnings

Merge pull request #5 from unicef-drp/feature/826-Remove-Django-Warnings #6

name: πŸ’½ Deploy to staging on PR Merge to develop
on:
push:
branches:
- develop
# Allow manually running in the actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
#env:
# WEB_FOLDER: /home/GeoRepo
jobs:
# Single deploy job since we're just deploying
build:
runs-on: ubuntu-latest
steps:
- name: πŸ›’ Checkout
uses: actions/checkout@v3
- name: πŸ”‘ Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
# We add it in the stop below
# known_hosts: unnecessary
- name: πŸ—‘οΈ Remove django-project folder
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_IP }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /home/GeoRepo
rm -rf django_project
rm -rf deployment/docker
rm -rf Makefile
- name: πŸ“‘ Deploy with rsync
run: |
rsync -avz -e "ssh -p ${{ secrets.SSH_PORT }}" /home/runner/work/GeoRepo/GeoRepo ${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}:/home
- name: πŸš€ Restart the container on the remote server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_IP }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /home/GeoRepo
make kill-django
make update
- name: 🧹 Remove SSH keys
run: rm -rf ~/.ssh
if: ${{ always() }}