hhhameem has initiated push to trigger Test, Build and Deploy workflow #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: Test, Build and Deploy | |
| run-name: ${{github.actor}} has initiated ${{github.event_name}} to trigger ${{github.workflow}} workflow | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| jobs: | |
| e2e-test-with-cypress: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18.19.0 | |
| - run: node -v | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cypress run test | |
| uses: cypress-io/github-action@v6 | |
| with: | |
| start: npm start | |
| wait-on: "http://localhost:3000" | |
| wait-on-timeout: 120 | |
| browser: chrome | |
| docker-image-build-and-push: | |
| runs-on: ubuntu-22.04 | |
| needs: e2e-test-with-cypress | |
| steps: | |
| - name: check docker version | |
| run: docker --version | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| push: true | |
| tags: ${{github.repository}}:latest | |
| deploy-to-render: | |
| runs-on: ubuntu-22.04 | |
| needs: docker-image-build-and-push | |
| steps: | |
| - name: deploy to render through webhook | |
| run: | | |
| echo "calling render deployment hook..." | |
| if [ $(curl --location ${{secrets.RENDER_DEPLOY_HOOK}} --write-out "%{http_code}" --output /dev/null) -ne 200 ]; | |
| then | |
| echo "HTTP Response status NOT 200, Deployment could not be possible"; | |
| exit 1; | |
| else | |
| echo "HTTP Response status 200 received. Deployment is initiated..."; | |
| fi | |
| echo "deployment hook calling complete" |