Skip to content

Commit

Permalink
Deployment workflow update to v5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DrizzlyOwl committed Feb 13, 2025
1 parent d1e42b2 commit c591ad2
Showing 1 changed file with 46 additions and 69 deletions.
115 changes: 46 additions & 69 deletions .github/workflows/build-and-push-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:
jobs:
set-env:
name: Determine environment
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
outputs:
environment: ${{ steps.var.outputs.environment }}
release: ${{ steps.var.outputs.release }}
Expand Down Expand Up @@ -50,36 +50,14 @@ jobs:
with:
environment: ${{ needs.set-env.outputs.environment }}

build:
name: Build
build-import-deploy:
name: Build, Import, Deploy
needs: [ set-env, validate-packages ]
runs-on: ubuntu-24.04
environment: ${{ needs.set-env.outputs.environment }}
permissions:
packages: write
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/build.yml@v4.1.0
strategy:
matrix:
image: [
"web",
"api"
]
include:
- image: "web"
tag-prefix: "dotnet-"
- image: "api"
tag-prefix: "dotnet-api-"
with:
environment: ${{ needs.set-env.outputs.environment }}
docker-image-name: ${{ needs.set-env.outputs.image-name }}
docker-build-args: CI=true
docker-build-file-name: ./Dockerfile.${{ matrix.image }}
docker-tag-prefix: ${{ matrix.tag-prefix }}

import:
name: Import
needs: [ set-env, build ]
permissions:
id-token: write
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/import.yml@v4.1.0
strategy:
matrix:
image: [
Expand All @@ -89,53 +67,52 @@ jobs:
include:
- image: "web"
tag-prefix: "dotnet-"
aca-name-secret: "ACA_CONTAINERAPP_NAME"
- image: "api"
tag-prefix: "dotnet-api-"
with:
environment: ${{ needs.set-env.outputs.environment }}
docker-image-name: ${{ needs.set-env.outputs.image-name }}
docker-tag-prefix: ${{ matrix.tag-prefix }}
secrets:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-acr-client-id: ${{ secrets.ACR_CLIENT_ID }}
azure-acr-name: ${{ secrets.ACR_NAME }}
aca-name-secret: "ACA_CONTAINERAPP_API_NAME"
steps:
- uses: DFE-Digital/deploy-azure-container-apps-action/.github/actions/build@v5.0.0
with:
build-file-name: ./Dockerfile.${{ matrix.image }}
build-args: CI=true
build-target: ${{ matrix.stage }}
image-name: ${{ needs.set-env.outputs.image-name }}
tag-prefix: ${{ matrix.tag-prefix }}
github-token: ${{ secrets.GITHUB_TOKEN }}

deploy:
name: Deploy
needs: [ set-env, import ]
permissions:
id-token: write
uses: DFE-Digital/deploy-azure-container-apps-action/.github/workflows/deploy.yml@v4.1.0
strategy:
matrix:
image: [
"web",
"api"
]
include:
- image: "web"
tag-prefix: "dotnet-"
aca_name_secret: "ACA_CONTAINERAPP_NAME"
- image: "api"
tag-prefix: "dotnet-api-"
aca_name_secret: "ACA_CONTAINERAPP_API_NAME"
with:
environment: ${{ needs.set-env.outputs.environment }}
docker-image-name: ${{ needs.set-env.outputs.image-name }}
docker-tag-prefix: ${{ matrix.tag-prefix }}
annotate-release: ${{ matrix.image == 'web' }}
secrets:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-acr-name: ${{ secrets.ACR_NAME }}
azure-aca-client-id: ${{ secrets.ACA_CLIENT_ID }}
azure-aca-name: ${{ secrets[matrix.aca_name_secret] }}
azure-aca-resource-group: ${{ secrets.ACA_RESOURCE_GROUP }}
- uses: DFE-Digital/deploy-azure-container-apps-action/.github/actions/import@v5.0.0
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-acr-client-id: ${{ secrets.ACR_CLIENT_ID }}
azure-acr-name: ${{ secrets.ACR_NAME }}
image-name: ${{ needs.set-env.outputs.image-name }}
tag-prefix: ${{ matrix.tag-prefix }}
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID || '' }}
AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION_ID || '' }}
AZURE_ACR_CLIENT_ID: ${{ secrets.ACR_CLIENT_ID || '' }}

- uses: DFE-Digital/deploy-azure-container-apps-action/.github/actions/deploy@v5.0.0
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-aca-client-id: ${{ secrets.ACA_CLIENT_ID }}
azure-aca-name: ${{ secrets[matrix.aca-name-secret] }}
azure-aca-resource-group: ${{ secrets.ACA_RESOURCE_GROUP }}
azure-acr-name: ${{ secrets.ACR_NAME }}
annotate-release: ${{ matrix.image == 'web' }}
image-name: ${{ needs.set-env.outputs.image-name }}
env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID || '' }}
AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION_ID || '' }}
AZURE_ACA_CLIENT_ID: ${{ secrets.ACA_CLIENT_ID || '' }}

create-tag:
name: Tag and release
needs: [ set-env, deploy-image ]
needs: [ set-env, build-import-deploy ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -169,7 +146,7 @@ jobs:
cypress-tests:
name: Run Cypress Tests
if: needs.set-env.outputs.environment == 'test' || needs.set-env.outputs.environment == 'development'
needs: [ deploy-image, set-env ]
needs: [ set-env, build-import-deploy ]
uses: ./.github/workflows/cypress.yml
with:
environment: ${{ needs.set-env.outputs.environment }}
Expand Down

0 comments on commit c591ad2

Please sign in to comment.