Merge pull request #2876 from HHS/OPS-2857/filter_CRs #351
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: Dev Backend Build and Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- backend/** | |
env: | |
WORKING_DIR: "backend" | |
DT_DOCKER_FILE: "Dockerfile.data-tools-import" | |
BE_DOCKER_FILE: "Dockerfile.ops-api" | |
ENVIRONMENT: dev | |
jobs: | |
build-data-tools: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Build and publish the Docker image for ${{ github.repository }} | |
uses: ./.github/actions/build-and-push | |
with: | |
image_name: ${{ github.repository }}/ops-data-tools # it will be lowercased internally | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
context: ${{ github.workspace }}/${{ env.WORKING_DIR }} | |
dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.DT_DOCKER_FILE }} | |
image_tags: "unstable,${{ github.sha }}" | |
build-backend: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Build and publish the Docker image for ${{ github.repository }} | |
uses: ./.github/actions/build-and-push | |
with: | |
image_name: ${{ github.repository }}/ops-backend # it will be lowercased internally | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
context: ${{ github.workspace }}/${{ env.WORKING_DIR }} | |
dockerfile: ${{ github.workspace }}/${{ env.WORKING_DIR }}/${{ env.BE_DOCKER_FILE }} | |
image_tags: "unstable,${{ github.sha }}" | |
deploy-data-tools: | |
needs: build-data-tools | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Log in to Azure | |
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1 | |
with: | |
creds: ${{ secrets.SDLC_AZURE_CREDS }} | |
- name: Trigger Data-Tools Job | |
uses: azure/cli@089eac9d8cc39f5d003e94f8b65efc51076c9cbd # v2 | |
with: | |
azcliversion: latest | |
inlineScript: | | |
# Update job to this image | |
az containerapp job update -n opre-ops-${{ env.ENVIRONMENT }}-app-data-tools -g opre-ops-${{ env.ENVIRONMENT }}-app-rg --image ghcr.io/hhs/opre-ops/ops-data-tools:${{ github.sha }} | |
# Start the data-tools job | |
az containerapp job start -n opre-ops-${{ env.ENVIRONMENT }}-app-data-tools -g opre-ops-${{ env.ENVIRONMENT }}-app-rg | |
# - name: Deploy Container App | |
# uses: azure/container-apps-deploy-action@5f5f4c56ca90376e3cfbd76ba8fe8533c784e655 # v2 | |
# with: | |
# # azureCredentials: ${{ secrets.AZURE_CREDS }} | |
# containerAppName: opre-ops-${{ env.ENVIRONMENT }}-data-tools | |
# resourceGroup: opre-ops-services-${{ env.ENVIRONMENT }}-app | |
# imageToDeploy: ghcr.io/hhs/opre-ops/ops-data-tools:${{ github.sha }} | |
deploy-backend: | |
needs: build-backend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Log in to Azure | |
uses: azure/login@6c251865b4e6290e7b78be643ea2d005bc51f69a # v2.1.1 | |
with: | |
creds: ${{ secrets.SDLC_AZURE_CREDS }} | |
- name: Deploy Container App | |
uses: azure/container-apps-deploy-action@5f5f4c56ca90376e3cfbd76ba8fe8533c784e655 # v2 | |
with: | |
containerAppName: opre-ops-${{ env.ENVIRONMENT }}-app-${{ env.WORKING_DIR }} | |
resourceGroup: opre-ops-${{ env.ENVIRONMENT }}-app-rg | |
imageToDeploy: ghcr.io/hhs/opre-ops/ops-backend:${{ github.sha }} |