Update index.js #8
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
| # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
| name: Node.js CI & Docker Deploy | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| deploy: | |
| runs-on: self-hosted | |
| strategy: | |
| matrix: | |
| node-version: [14.x] | |
| steps: | |
| # Checkout repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| # Use Node.js | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| # Install Node dependencies | |
| - name: Install Node dependencies | |
| run: npm ci | |
| # Build Node project | |
| - name: Build Node project | |
| run: npm run build --if-present | |
| # Install additional dependencies (optional) | |
| - name: Install additional dependencies | |
| run: npm install | |
| # Build Docker Compose images | |
| - name: Build Docker Compose images | |
| working-directory: /home/mnagaraju/actions-runner-repo2/testing-project-2 | |
| run: docker-compose -f docker-compose-test.yml build --no-cache app | |
| # Start Docker Compose services | |
| - name: Start Docker Compose services | |
| working-directory: /home/mnagaraju/actions-runner-repo2/testing-project-2 | |
| run: docker-compose -f docker-compose-test.yml up -d app |