Merge pull request #5 from unicef-drp/feature/826-Remove-Django-Warnings #6
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 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() }} |