Skip to content

Merge pull request #4 from unicef-drp/feature/824-View-Listing-Server… #7

Merge pull request #4 from unicef-drp/feature/824-View-Listing-Server…

Merge pull request #4 from unicef-drp/feature/824-View-Listing-Server… #7

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() }}