test ocr build and deploy with changes #32
Workflow file for this run
This file contains 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: Create, publish, deploy a OCR API image | |
on: | |
push: | |
branches: fix-docker-image-check | |
# workflow_dispatch: | |
# inputs: | |
# deploy-env: | |
# description: 'The environment to deploy to' | |
# required: true | |
# type: choice | |
# options: | |
# - dev | |
# - demo | |
# ocr-version: | |
# description: 'Create a version for this OCR API image' | |
# required: true | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
jobs: | |
build-publish-ocr: | |
name: Build and Publish OCR | |
runs-on: ubuntu-latest | |
outputs: | |
docker_inspect: ${{ steps.image_check.outputs.docker_inspect }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
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: | | |
echo "docker_inspect=$( | |
docker manifest inspect ghcr.io/${{ env.REPO }}-ocr-api:derek-clean-up-test > /dev/null ; echo $? | |
)" >> $GITHUB_OUTPUT | |
- name: Build and Push backend | |
if: ${{ steps.image_check.outputs.docker_inspect == 1 }} | |
uses: ./.github/actions/build-publish-api | |
with: | |
docker-registry: ghcr.io | |
docker-pw: ${{ secrets.GITHUB_TOKEN }} | |
docker-username: ${{ github.actor }} | |
docker-tag: derek-clean-up-test | |
dockerfile-path: ./OCR/Dockerfile | |
docker-context-path: ./OCR/ | |
api-name: ocr-api | |
deploy-ocr: | |
name: Deploy OCR | |
runs-on: ubuntu-latest | |
environment: dev | |
needs: [build-publish-ocr] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Deploy OCR-API | |
uses: ./.github/actions/deploy-api | |
with: | |
deploy-env: dev | |
docker-tag: derek-clean-up-test | |
docker-registry: ghcr.io | |
api-name: ocr-api |