Skip to content

fix: Fixed the spelling of career. #74

fix: Fixed the spelling of career.

fix: Fixed the spelling of career. #74

name: CI/CD Digital Ocean PROD
on:
push:
branches: [deploy]
env:
VITE_CLIENT_URL: ${{secrets.VITE_CLIENT_URL_PROD}}
VITE_SERVER_URL: ${{secrets.VITE_SERVER_URL_PROD}}
VITE_PROD: ${{secrets.VITE_PROD}}
VITE_GOOGLE_ANALYTICS_KEY: ${{secrets.VITE_GOOGLE_ANALYTICS_KEY_PROD}}
VITE_APP_NAME: ${{secrets.VITE_APP_NAME_PROD}}
VITE_ASSET_FOLDER: ${{secrets.VITE_ASSET_FOLDER_PROD}}
VITE_TAWK_PROPERTY_ID: ${{secrets.VITE_TAWK_PROPERTY_ID_PROD}}
VITE_TAWK_WIDGET_ID: ${{secrets.VITE_TAWK_WIDGET_ID_PROD}}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install and Build Client
run: cd client && npm install && npm run build
- name: Install and Build Server
run: cd api && npm install && npm run build
- name: Upload to Server Digital Ocean
uses: appleboy/scp-action@master # This is the action
with:
host: ${{secrets.SSH_HOST_PROD}} # IP address of the server you wish to ssh into
key: ${{secrets.SSH_KEY}} # Private or public key of the server
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into
passphrase: ${{ secrets.SSH_PASSPHRASE }}
source: 'api/dist' # Path to the directory you want to copy
target: '~/' # Path to the directory you want to copy to
- name: Upload to Client Digital Ocean
uses: appleboy/scp-action@master # This is the action
with:
host: ${{secrets.SSH_HOST_PROD}} # IP address of the server you wish to ssh into
key: ${{secrets.SSH_KEY}} # Private or public key of the server
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into
passphrase: ${{ secrets.SSH_PASSPHRASE }}
source: 'client/dist' # Path to the directory you want to copy
target: '/var/www/html' # Path to the directory you want to copy to
- name: Start Server
uses: appleboy/[email protected] # This is the action
with:
host: ${{secrets.SSH_HOST_PROD}} # IP address of the server you wish to ssh into
key: ${{secrets.SSH_KEY}} # Private or public key of the server
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
rm -rf ~/Vita
git clone https://github.com/Vita-App/Vita.git
mv ~/api/dist Vita/api/
cd ~/Vita/api && npm install && cd ~/ && rm -rf ./api
pm2 stop vita-server
pm2 start ~/env/ecosystem.config.js --env production
echo 'Deployment successful to digital ocean'