aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/docker-build.yml
blob: 86f881dc70bf0400044c1cabea2aa90b26a42c30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: "Docker Continuous Deployment"

on:
  release:
    types: [published]

jobs:
  build_docker_image:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Login to GitHub Container Registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GHCR_DOCKER_PWD }}

      - name: Build and push docker image
        uses: docker/build-push-action@v5
        with:
          context: .
          push: true
          tags: |
            ghcr.io/ghoshritesh12/aniwatch:${{ github.event.release.tag_name }}
            ghcr.io/ghoshritesh12/aniwatch:latest

  trigger_deploy:
    needs: build_docker_image
    runs-on: ubuntu-latest

    steps:
      - name: Trigger render deploy
        run: |
          curl --request POST \
            --url https://api.render.com/v1/services/${{ secrets.RENDER_API_SERVICE_ID }}/deploys \
            --header 'accept: application/json' \
            --header 'authorization: Bearer ${{ secrets.RENDER_API_KEY }}' \
            --header 'content-type: application/json' \
            --data '{ "clearCache": "clear" }'