Skip to content

debug

debug #6

Workflow file for this run

name: Deploy
on:
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Set env vars (common)
run: |
echo "REMOTE_APP_FOLDER=~/htdocs/NILIS-MIS" >> $GITHUB_ENV
- name: Set env vars (prod)
if: endsWith(github.ref, '/dev')
run: |
echo "REMOTE_APP_ENV=prod" >> $GITHUB_ENV
echo "REMOTE_HOST="${{ secrets.SSH_HOST }} >> $GITHUB_ENV
- name: Checkout code ⚙️
uses: actions/checkout@v2
- name: Compress codebase
run: |
tar -zcvf project.tar.gz ./*
- name: Copy project to server 📄
uses: nogsantos/scp-deploy@master
with:
src: ./project.tar.gz
host: ${{ env.REMOTE_HOST }}
remote: ${{ env.REMOTE_APP_FOLDER }}
port: ${{ secrets.SSH_PORT }}
user: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
- name: SSH Decompress ⚙️
uses: appleboy/ssh-action@master
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd ${{ env.REMOTE_APP_FOLDER }}
tar xvzf ./project.tar.gz --directory ./
rm ./project.tar.gz
- name: Deploy application 🚀
uses: appleboy/ssh-action@master
with:
host: ${{ env.REMOTE_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
sudo /opt/bitnami/ctlscript.sh restart apache