Skip to content

chore: Direct deploy pipeline edit #22

chore: Direct deploy pipeline edit

chore: Direct deploy pipeline edit #22

Workflow file for this run

name: Deploy
on:
workflow_dispatch:
push:
branches: [ "develop" ]
env:
DOTNET_VERSION: "6.0.x"
NODE_VERSION: "18.x"
BACKEND_PATH: "binder-web-backend"
FRONTEND_PATH: "binder-web-frontend"
WEB_SERVER_PATH: "/var/www"
BACKEND_PUBLISH_PATH: "backend"
FRONTEND_PUBLISH_PATH: "frontend"
jobs:
backend-build:
runs-on: ubuntu-latest
steps:
- name: Check out code 👀
uses: actions/checkout@v3
- name: Setup .NET ${{ env.DOTNET_VERSION }} 🔨
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies 🔧
run: dotnet restore ${{ env.BACKEND_PATH }}
- name: Build app 🚀
run: dotnet publish ${{ env.BACKEND_PATH }} --no-restore -o ${{ env.BACKEND_PUBLISH_PATH }}
- name: Copy Web Backend via SCP
uses: appleboy/scp-action@master
with:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
source: ./${{ env.BACKEND_PATH }}
target: ${{ env.WEB_SERVER_PATH }}/${{ env.BACKEND_PUBLISH_PATH }}
overwrite: true
frontend-build:
needs: backend-build
runs-on: ubuntu-latest
steps:
- name: Check out code 👀
uses: actions/checkout@v3
- name: Setup Node.js ${{ env.NODE_VERSION }} 🔨
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ${{ env.FRONTEND_PATH }}/package-lock.json
- name: Clean install of dependencies 🔧
run: npm ci --prefix ${{ env.FRONTEND_PATH }}
- name: Build app 🚀
run: npm run build --prefix ${{ env.FRONTEND_PATH }} --if-present
- name: Copy Web Frontend via SCP
uses: appleboy/scp-action@master
with:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
source: ./${{ env.FRONTEND_PATH }}/dist
target: ${{ env.WEB_SERVER_PATH }}/${{ env.FRONTEND_PUBLISH_PATH }}
overwrite: true
run-services:
needs: [backend-build, frontend-build]
runs-on: ubuntu-latest
steps:
- name: Start Services via SSH
uses: appleboy/ssh-action@master
with:
HOST: ${{ secrets.HOST }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
script: ls