Add production deploy workflow and PM2 config #6
This file contains hidden or 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
| name: Node.js CI/CD Pipeline | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - development | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@main | |
| - name: Setup Node.js | |
| uses: actions/setup-node@main | |
| with: | |
| node-version: "24" | |
| - name: Cache node modules | |
| uses: actions/cache@main | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| - name: Install dependencies and run the test | |
| run: npm install && npm test | |
| deploy: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@main | |
| - name: Deploy the app on the server | |
| run: echo "Deploying to production..." | |
| - name: Wait for service to be ready | |
| run: sleep 5 |