Skip to content

Deploy Dev App

Deploy Dev App #19

name: "Deploy Dev App"
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: "Copies development branch to ourchive-dev server"
env:
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
dev_env_file: ${{ secrets.DEV_ENV_FILE }}
local_dir: "ourchive_app"
remote_dir: "/home/ourchive-integration/dev_deploy"
run: |
mkdir ~/.ssh
echo "$remote_key" > ~/.ssh/id_github
chmod 600 ~/.ssh/id_github
sudo apt-get install python3-pip python3-dev
sudo -H pip3 install virtualenv
virtualenv venv
source venv/bin/activate
pip install django
pip install -r ourchive_app/requirements.txt
python ourchive_app/manage.py collectstatic
rsync -avzr -e "ssh -p ${remote_port} -i ~/.ssh/id_github -o StrictHostKeyChecking=no" ${local_dir} ${remote_user}@${remote_host}:${remote_dir}
rm ~/.ssh/id_github
- name: Execute Python Script
env:
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
run: |
echo "$remote_key" > ~/.ssh/id_github
chmod 600 ~/.ssh/id_github
ssh ${remote_user}@${remote_host} -i ~/.ssh/id_github -o StrictHostKeyChecking=no
cd dev_deploy
bash test.sh
exit
rm ~/.ssh/id_github