Final successful deployment with working nginx configuration #23
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: Continuous Integration | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linting | |
| run: npm run lint | |
| - name: Run tests | |
| run: npm test | |
| - name: Build application | |
| run: npm run build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: build-artifacts | |
| path: src/ | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v3 | |
| with: | |
| name: build-artifacts | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build Docker image | |
| run: | | |
| docker build -t devops-task-manager:${{ github.sha }} . | |
| docker build -t devops-task-manager:latest . | |
| - name: Log in to Docker Hub | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| - name: Push Docker image | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| docker tag devops-task-manager:${{ github.sha }} ${{ secrets.DOCKER_USERNAME }}/devops-task-manager:${{ github.sha }} | |
| docker tag devops-task-manager:latest ${{ secrets.DOCKER_USERNAME }}/devops-task-manager:latest | |
| docker push ${{ secrets.DOCKER_USERNAME }}/devops-task-manager:${{ github.sha }} | |
| docker push ${{ secrets.DOCKER_USERNAME }}/devops-task-manager:latest |