diff --git a/.github/workflows/deploy-prod-be.yml b/.github/workflows/deploy-prod-be.yml new file mode 100644 index 00000000..e7d789b1 --- /dev/null +++ b/.github/workflows/deploy-prod-be.yml @@ -0,0 +1,33 @@ +name: Deploy BE to Prodction Top Mezon AI + +on: + push: + branches: + - main + paths: + - 'backend/**' + - '.github/workflows/deploy-prod-be.yml' + +jobs: + deploy: + runs-on: top-prod + environment: production + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Cache Node Module + uses: actions/cache@v4 + + - name: Update Env-Config + run: | + cd backend/ + echo '${{ secrets.ENV_PROD_BE }}' > .env.prod + + - name: Build BE & Deploy + run: | + cd backend/ + nvm use 20.18.1 + yarn + yarn build + pm2 restart 0 \ No newline at end of file diff --git a/.github/workflows/deploy-prod-fe.yml b/.github/workflows/deploy-prod-fe.yml new file mode 100644 index 00000000..e85e755c --- /dev/null +++ b/.github/workflows/deploy-prod-fe.yml @@ -0,0 +1,32 @@ +name: Deploy FE to Prodction Top Mezon AI + +on: + push: + branches: + - main + paths: + - 'frontend/**' + - '.github/workflows/deploy-prod-fe.yml' +jobs: + deploy: + runs-on: top-prod + environment: production + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Cache Node Module + uses: actions/cache@v4 + + - name: Update Env-Config + run: | + cd frontend/ + echo '${{ secrets.ENV_PROD_FE }}' > .env + + - name: Build FE & Deploy + run: | + cd frontend/ + nvm use 20.18.1 + yarn + yarn build + cp -r dist/* /var/www/top-mezon-ai/