Skip to content

Merge pull request #536 from Scents-Note/dev #30

Merge pull request #536 from Scents-Note/dev

Merge pull request #536 from Scents-Note/dev #30

name: Deploy production server to ec2
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Deploy to EC2 using SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
cp ~/config-injection/ecosystem-${{ env.SERVER_PROFILE }}.json ${{ env.PROJECT_PATH }}/ecosystem.json &&
cp ~/config-injection/envs/.env.${{ env.NODE_ENV }} ${{ env.PROJECT_PATH }}/.env &&
cd ${{ env.PROJECT_PATH }} &&
git fetch --all &&
git checkout ${{ env.BRANCH_NAME }} &&
git pull origin ${{ env.BRANCH_NAME }} &&
bash script/prebuild.sh &&
bash script/reload.sh
env:
BRANCH_NAME: main
NODE_ENV: production
SERVER_PROFILE: production
PROJECT_PATH: ~/actions-runner/_work/A.fume.Server/A.fume.Server/production