Skip to content

Merge pull request #470 from GroupProject-JOM/dev #15

Merge pull request #470 from GroupProject-JOM/dev

Merge pull request #470 from GroupProject-JOM/dev #15

Workflow file for this run

name: BuildDeploy
on:
push:
branches:
- deployment
jobs:
build:
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- name: Set env vars (common)
run: |
echo "REMOTE_HOST="${{ secrets.SSH_HOST }} >> $GITHUB_ENV
echo "REMOTE_APP_FOLDER=/var/www/html/Frontend-web-" >> $GITHUB_ENV
- name: Compress Files
run: |
wget https://github.com/GroupProject-JOM/Frontend-web-/archive/refs/heads/deployment.zip
unzip deployment.zip
cd Frontend-web--deployment/
touch build.tar.gz
tar --exclude='./github' --exclude='./build.tar.gz' -zcvf build.tar.gz ./
- name: Copy build to server
uses: nogsantos/scp-deploy@master
with:
src: ./Frontend-web--deployment/build.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 ./build.tar.gz --directory ./
rm -rf ./build.tar.gz
- name: SSH Start/Restart Application
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 }}
sudo systemctl reload nginx