Skip to content

Merge pull request #192 from alwinsimon/main #39

Merge pull request #192 from alwinsimon/main

Merge pull request #192 from alwinsimon/main #39

# ===================================================== Production Branch CI Configuration =====================================================
name: Production-Branch-Pre-Merge-CI
on:
push:
branches: [ "production-branch" ]
pull_request:
branches: [ "production-branch" ]
jobs:
Production-Branch-Pre-Integration-Tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v3
# Installing Node.js at the test instance
- name: Setting up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# Printing the node version in the terminal
- name: Checking Node Version
run: node --version
# Installation of Node packaging Manager (npm)
- name: Installing Node packaging Manager (npm)
run: npm ci
# Setting up the environment variable from using credentials stored in GitHub actions secret
- name: Setting up environment variables
run: |
echo "MY_ENV_VARIABLE=${{ secrets.ENV_FILE }}" >> .env
# Installation of Node packaging Manager (npm)
- name: Installing project dependencies
run: npm install
# Checking if node modules were installed (Done by simply checking if the node_modules directory exists or not)
- name: Checking if Node Modules directory was created after installing NPM
run: |
if [ ! -d "node_modules" ]; then
echo "Error: node_modules directory does not exist."
exit 1
fi
# Installation of Process Manager 2 (PM2)
- name: Installing Process Manager 2 (PM2)
run: npm i pm2 -g
# Start the application with Process Manager 2 (PM2)
- name: Initiating the application with Process Manager 2 (PM2)
run: pm2 start ./bin/www --name "production-server"
# Log the status of application with Process Manager 2 (PM2)
- name: Logging the status of application with Process Manager 2 (PM2)
run: pm2 status all