Update node.js.yml #65
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 | |
| on: | |
| push: | |
| branches: | |
| - main # Trigger on push to main branch | |
| pull_request: | |
| branches: | |
| - main # Trigger on PR to main branch | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out the code | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| # Set up Node.js | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '16' # Specify Node.js version | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: | | |
| cd src/npm | |
| npm install express multer cors axios | |
| # Run server.js in the background | |
| - name: Run server.js | |
| run: | | |
| cd src/npm | |
| nohup node server.js & # Run in the background | |
| echo "Server is running on port 8080" | |
| # Workflow completes here, without waiting for the server | |
| - name: Finish workflow | |
| run: | | |
| echo "The server is now running in the background." |