Skip to content

Commit

Permalink
Update nodejs-ci.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
apurvjha123 authored Oct 26, 2024
1 parent f3aeb24 commit 31f586a
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,31 @@ jobs:
node-version: [18.x]

steps:
- uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- run: npm ci

- name: Set environment variables
run: |
touch .env
echo "${{ secrets.PROD_SECRET }}" > .env
- name: Install PM2
run: npm install -g pm2

- name: Start application with PM2
run: pm2 restart dist/index.js --interpreter node
- uses: actions/checkout@v3

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm' # This line enables automatic caching for npm dependencies

- name: Cache Node.js modules
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci

- name: Set environment variables
run: |
touch .env
echo "${{ secrets.PROD_SECRET }}" > .env
- name: Install PM2
run: npm install -g pm2

- name: Start application with PM2
run: pm2 restart dist/index.js --interpreter node

0 comments on commit 31f586a

Please sign in to comment.