Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

CMS deployment

CMS deployment #60

Workflow file for this run

name: CMS deployment
concurrency: cms
on:
workflow_dispatch:
push:
branches:
- main
paths:
- ".github/workflows/**"
- "infrastructure/**"
- "cms/**"
permissions:
id-token: write
jobs:
deploy_infra:
name: Deploy infrastructure
runs-on: ubuntu-latest
environment: production
outputs:
containerRegistryName: ${{ steps.deployinfra.outputs.containerRegistryName }}
containerAppEnvironmentName: ${{ steps.deployinfra.outputs.containerAppEnvironmentName }}
containerAppName: ${{ steps.deployinfra.outputs.containerAppName }}
resourceGroupName: ${{ steps.deployinfra.outputs.resourceGroupName }}
resourceLocation: ${{ steps.deployinfra.outputs.resourceLocation }}
steps:
- uses: actions/checkout@v4
- name: Login to Azure
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 infrastructure
id: deployinfra
uses: azure/arm-deploy@v2
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
scope: "subscription"
template: ./infrastructure/cms.bicep
parameters: "environment=production databaseClient=${{ vars.CMS_DATABASE_CLIENT }}"
region: ${{ vars.AZURE_REGION }}
push_image_to_acr:
name: Build and push Docker image to Azure Container Registry
runs-on: ubuntu-latest
needs: [deploy_infra]
steps:
- uses: actions/checkout@v4
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Build and deploy CMS container app
uses: azure/container-apps-deploy-action@v1
with:
appSourcePath: ${{ github.workspace }}
acrName: ${{ needs.deploy_infra.outputs.containerRegistryName }}
acrUsername: ${{ secrets.AZURE_CLIENT_ID }}
acrPassword: ${{ secrets.AZURE_CLIENT_SECRET }}
containerAppEnvironment: ${{ needs.deploy_infra.outputs.containerAppEnvironmentName }}
containerAppName: ${{ needs.deploy_infra.outputs.containerAppName }}
resourceGroup: ${{ needs.deploy_infra.outputs.resourceGroupName }}
dockerfilePath: infrastructure/Dockerfile.cms
imageToBuild: ${{ needs.deploy_infra.outputs.containerRegistryName }}.azurecr.io/strapi-playground/cms:latest
location: ${{ needs.deploy_infra.outputs.resourceLocation }}