Remove LegacyUserRoles class (#3455) #2619
This file contains hidden or 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: Build & deploy main | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| checks: write | |
| deployments: write | |
| packages: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| package: | |
| name: Package application | |
| uses: ./.github/workflows/package.yml | |
| secrets: inherit | |
| deploy_dev: | |
| name: Deploy dev environment | |
| runs-on: ubuntu-latest | |
| needs: [package] | |
| environment: dev | |
| concurrency: deploy_dev | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/workflows/actions/deploy-aks-environment | |
| id: deploy | |
| with: | |
| environment_name: dev | |
| docker_image: ${{ needs.package.outputs.docker_image }} | |
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| check_environments: | |
| name: Check environment deployments | |
| runs-on: ubuntu-latest | |
| outputs: | |
| deploy_preprod: ${{ steps.check_preprod_deployment.outputs.deploy_preprod }} | |
| steps: | |
| - uses: actions/github-script@v9 | |
| id: check_preprod_deployment | |
| with: | |
| script: | | |
| // If the current pre-prod deployment is not main then we don't want to overwrite it | |
| const { owner, repo } = context.repo; | |
| const preprodEnvironmentName = "pre-production"; | |
| const deployments = await github.rest.repos.listDeployments({ owner, repo, environment: preprodEnvironmentName, per_page: 1 }); | |
| const lastDeploymentBranch = deployments.data[0].ref; | |
| let deployPreprod = true; | |
| if (lastDeploymentBranch !== "main") { | |
| const branches = await github.rest.repos.listBranches({ owner, repo }); | |
| if (branches.data.map(b => b.name).includes(lastDeploymentBranch)) { | |
| deployPreprod = false; | |
| core.info(`${preprodEnvironmentName} has a non-main branch deployed`); | |
| } | |
| } | |
| core.setOutput("deploy_preprod", deployPreprod); | |
| deploy_preprod: | |
| name: Deploy pre-production environment | |
| runs-on: ubuntu-latest | |
| needs: [package, deploy_dev, check_environments] | |
| if: needs.check_environments.outputs.deploy_preprod == 'true' | |
| environment: pre-production | |
| concurrency: deploy_pre-production | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/workflows/actions/deploy-aks-environment | |
| id: deploy | |
| with: | |
| environment_name: pre-production | |
| docker_image: ${{ needs.package.outputs.docker_image }} | |
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| deploy_prod: | |
| name: Deploy production environment | |
| runs-on: ubuntu-latest | |
| needs: [deploy_dev, package, deploy_preprod] | |
| if: always() && (needs.deploy_preprod.result == 'success' || needs.deploy_preprod.result == 'skipped') && (needs.package.result == 'success') && (needs.deploy_dev.result == 'success') | |
| environment: production | |
| concurrency: deploy_production | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/workflows/actions/deploy-aks-environment | |
| id: deploy | |
| with: | |
| environment_name: production | |
| docker_image: ${{ needs.package.outputs.docker_image }} | |
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| deploy_tps-sandbox: | |
| name: Deploy TPS sandbox environment | |
| runs-on: ubuntu-latest | |
| needs: [deploy_prod, package] | |
| if: always() && needs.deploy_prod.result == 'success' | |
| environment: tps-sandbox | |
| concurrency: deploy_tps-sandbox | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/workflows/actions/deploy-aks-environment | |
| id: deploy | |
| with: | |
| environment_name: tps-sandbox | |
| docker_image: ${{ needs.package.outputs.docker_image }} | |
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| deploy_domains_infra: | |
| name: Deploy Domains Infrastructure | |
| runs-on: ubuntu-latest | |
| if: always() && needs.deploy_prod.result == 'success' | |
| concurrency: deploy_domains_infra | |
| needs: [deploy_prod] | |
| environment: | |
| name: production | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Deploy Domains Infrastructure | |
| uses: DFE-Digital/github-actions/deploy-domains-infra@master | |
| with: | |
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| slack-webhook: ${{ secrets.SLACK_WEBHOOK }} | |
| deploy_domains_env: | |
| name: Deploy Domains to ${{ matrix.domain_environment }} environment | |
| runs-on: ubuntu-22.04 | |
| if: always() && needs.deploy_domains_infra.result == 'success' | |
| concurrency: deploy_domains_env_${{ matrix.domain_environment }} | |
| needs: [deploy_domains_infra] | |
| strategy: | |
| max-parallel: 1 | |
| matrix: | |
| domain_environment: [dev, pre-production, production, tps-sandbox] | |
| environment: | |
| name: production | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Deploy Domains Environment | |
| id: deploy_domains_env | |
| uses: DFE-Digital/github-actions/deploy-domains-env@master | |
| with: | |
| azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
| azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| environment: ${{ matrix.domain_environment }} | |
| healthcheck: health | |
| teams-webhook-url: ${{ secrets.TEAMS_WEBHOOK_URL }} | |
| service: ${{ vars.TEAMS_MSG_SERVICE_NAME }} |