diff --git a/.github/workflows/build-deploy-frontend.yml b/.github/workflows/build-deploy-frontend.yml index 08b59912..29b74ccb 100644 --- a/.github/workflows/build-deploy-frontend.yml +++ b/.github/workflows/build-deploy-frontend.yml @@ -1,7 +1,9 @@ name: Build and Deploy Frontend on: - workflow_dispatch: + push: + branches: enable-auto-scaling-tf + # workflow_dispatch: permissions: id-token: write @@ -25,7 +27,7 @@ jobs: - name: Install NPM packages run: npm ci - name: Build project - run: VITE_API_URL='https://reportvision-ocr-dev.azurewebsites.net/' npm run build + run: VITE_API_URL='https://reportvision-ocr-dev2.azurewebsites.net/' npm run build - name: Run unit tests run: npm run test - name: Create client build archive @@ -43,7 +45,7 @@ jobs: deploy: name: Deploy runs-on: ubuntu-latest - environment: build-frontend-dev + environment: dev2 needs: [build] steps: - name: Download Artifacts To Job @@ -66,7 +68,7 @@ jobs: - name: Upload to Azure blob storage shell: bash run: | - az storage blob upload-batch --account-name reportvisionfrontenddev -d '$web' -s client-build/ --overwrite + az storage blob upload-batch --account-name reportvisionfrontenddev2 -d '$web' -s client-build/ --overwrite - name: Azure logout shell: bash run: | diff --git a/.github/workflows/build-deploy-ocr.yml b/.github/workflows/build-deploy-ocr.yml index 1fba1752..9c558297 100644 --- a/.github/workflows/build-deploy-ocr.yml +++ b/.github/workflows/build-deploy-ocr.yml @@ -1,49 +1,47 @@ name: Create, publish, deploy a OCR API image on: - push: - branches: enable-auto-scaling-tf - # workflow_dispatch: - # inputs: - # tag: - # description: 'Version tag for new release' - # required: true + workflow_dispatch: + inputs: + tag: + description: 'Version tag for new release' + required: true env: REGISTRY: ghcr.io - VERSION: resusable-deploy-test-derek + VERSION: ${{ inputs.tag }} jobs: - # build-and-push-image: - # runs-on: ubuntu-latest - # permissions: - # contents: read - # packages: write - # attestations: write - # id-token: write - # steps: - # - name: Checkout repository - # uses: actions/checkout@v4 - # - name: Log in to the Container registry - # uses: docker/login-action@v3 - # with: - # registry: ${{ env.REGISTRY }} - # 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: docker manifest inspect ${{ env.REGISTRY }}/${{ env.REPO }}-ocr-api:${{ env.VERSION }} > /dev/null ; echo $? - # - name: Build and push Docker image - # id: push - # uses: docker/build-push-action@v6 - # with: - # context: ./OCR/ - # file: ./OCR/Dockerfile - # push: true - # tags: ${{ env.REGISTRY }}/${{ env.REPO }}-ocr-api:${{ env.VERSION }} + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + 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: docker manifest inspect ${{ env.REGISTRY }}/${{ env.REPO }}-ocr-api:${{ env.VERSION }} > /dev/null ; echo $? + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v6 + with: + context: ./OCR/ + file: ./OCR/Dockerfile + push: true + tags: ${{ env.REGISTRY }}/${{ env.REPO }}-ocr-api:${{ env.VERSION }} deploy: runs-on: ubuntu-latest @@ -52,7 +50,8 @@ jobs: packages: write attestations: write id-token: write - environment: dev2 + needs: build-and-push-image + environment: dev steps: - uses: azure/login@v2 with: @@ -67,6 +66,6 @@ jobs: id: deploy-to-webapp uses: azure/webapps-deploy@v3 with: - app-name: reportvision-ocr-dev2 + app-name: reportvision-ocr-dev images: '${{ env.REGISTRY }}/${{ env.REPO}}-ocr-api:${{ env.VERSION }}'