feat: add CI/CD workflow for build and deployment #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#workflow name | |
name: "Build & Deploy Bot" | |
#event, trigger action that running our Jobs. | |
#In this file we trigger pm2-configuration every we push code to repository. | |
on: [push] | |
jobs: | |
build-and-deploy: | |
runs-on: self-hosted | |
env: | |
TOKEN: ${{secrets.TOKEN}} | |
CLIENT_ID: ${{secrets.CLIENT_ID}} | |
REDIS_URL: ${{secrets.REDIS_URI}} | |
CLOUDINARY_URL: ${{secrets.CLOUDINARY_URL}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Package | |
run: "yarn install --immutable --immutable-cache --check-cache" | |
- run: "yarn run build" | |
- name: Deploy To Server | |
run: "pm2 status | grep -q essabot && pm2 restart essabot --update-env || pm2 start yarn --name essabot -- run production" | |