Skip to content

Commit

Permalink
Try to fix Docker image check
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator committed Oct 29, 2024
1 parent 8002d3f commit 7c4645c
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/build-deploy-ocr.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: Create, publish, deploy a OCR API image

on:
workflow_dispatch:
inputs:
tag:
description: 'Version tag for new release'
required: true
push:
branches: fix-docker-image-check
# workflow_dispatch:
# inputs:
# tag:
# description: 'Version tag for new release'
# required: true

env:
REGISTRY: ghcr.io
VERSION: ${{ inputs.tag }}
VERSION: demo-test-env-derek


jobs:
Expand All @@ -20,6 +22,8 @@ jobs:
packages: write
attestations: write
id-token: write
outputs:
tf_env: ${{ steps.set-environment.outputs.tf_env }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -31,12 +35,16 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase the repo name
run: echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
# - name: Check if image exists
# id: image_check
# run: docker manifest inspect ${{ env.REGISTRY }}/${{ env.REPO }}-ocr-api:${{ env.VERSION }} > /dev/null ; echo $?
- name: Check if image exists
id: image_check
run: |
echo "tf_env=$(
docker manifest inspect ${{ env.REGISTRY }}/${{ env.REPO }}-ocr-api:${{ env.VERSION }} > /dev/null ; echo $?
)" >> $GITHUB_OUTPUT
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
if: ${{ steps.image_check.outputs.tf_env == 1 }}
with:
context: ./OCR/
file: ./OCR/Dockerfile
Expand All @@ -51,7 +59,7 @@ jobs:
attestations: write
id-token: write
needs: build-and-push-image
environment: dev
environment: dev3
steps:
- uses: azure/login@v2
with:
Expand All @@ -66,6 +74,6 @@ jobs:
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: reportvision-ocr-dev
app-name: reportvision-ocr-dev3
images: '${{ env.REGISTRY }}/${{ env.REPO}}-ocr-api:${{ env.VERSION }}'

0 comments on commit 7c4645c

Please sign in to comment.