Skip to content

fix: 🔨 build issue #116

fix: 🔨 build issue

fix: 🔨 build issue #116

# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: GitHub CI/CD (Auto Deploy)
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
types: ["closed"]
jobs:
build:
runs-on: self-hosted
strategy:
matrix:
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm -g install [email protected]
- run: npm -g install pm2
- name: "Create env file"
run: |
echo "${{ secrets.ENV_FILE }}" > .env
working-directory: apps/api
- name: "Install dependencies and build"
run: |
yarn install
yarn build
working-directory: apps/api
- name: "Restart The Server"
run: pm2 restart server.aafiyah.com
- name: Send deployment success notification
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
# Server port, default 25:
server_port: 465
# Optional whether this connection use TLS (default is true if server_port is 465)
secure: true
# Optional (recommended) mail server username:
username: ${{secrets.MAIL_USERNAME}}
# Optional (recommended) mail server password:
password: ${{secrets.MAIL_PASSWORD}}
# Required mail subject:
subject: Aafiyah | Deployment Success
# Required recipients' addresses:
to: [email protected]
# Required sender full name (address can be skipped):
from: Hasib <${{secrets.MAIL_USERNAME}}> # <[email protected]>
# Optional plain body:
body: Hey Team, The latest code deployed. The server is up and running.
# Optional priority: 'high', 'normal' (default) or 'low'
priority: high