Merge pull request #3139 from HHS/update-URLs-in-API-spec #408
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Log in to Azure | |
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0 | |
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Log in to Azure | |
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0 | |
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 }} |