Skip to content

fix: update output url #10

fix: update output url

fix: update output url #10

Workflow file for this run

name: Conditional Deploy to Server
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Try Git Pull on Server
id: git-pull
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /www/wwwroot/MMGC/MMGC-frontend
git pull || echo "Git pull failed, proceeding with SCP"
- name: Clear Remote Directory if Git Pull Fails
if: steps.git-pull.outcome == 'failure'
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
rm -rf /www/wwwroot/MMGC/MMGC-frontend/*
- name: Copy Repository to Server if Git Pull Fails
if: steps.git-pull.outcome == 'failure'
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: '.'
target: '/www/wwwroot/MMGC/MMGC-frontend'
- name: Install and Build on Server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /www/wwwroot/MMGC/MMGC-frontend
npm install
pm2 delete MMGCApp && npm run start:build