-
Notifications
You must be signed in to change notification settings - Fork 5
60 lines (49 loc) · 1.9 KB
/
Main-Branch-CI.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Main-Branch-CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
Main-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