Skip to content

Start at /swagger with running API locally (#1695) #1090

Start at /swagger with running API locally (#1695)

Start at /swagger with running API locally (#1695) #1090

Workflow file for this run

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
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@v7
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_test:
name: Deploy test environment
runs-on: ubuntu-latest
needs: [package]
environment: test
concurrency: deploy_test
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/actions/deploy-aks-environment
id: deploy
with:
environment_name: test
docker_image: ${{ needs.package.outputs.docker_image }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
deploy_preprod:
name: Deploy pre-production environment
runs-on: ubuntu-latest
needs: [package, deploy_test, check_environments]
if: needs.check_environments.outputs.deploy_preprod == 'true'
environment: pre-production
concurrency: deploy_pre-production
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/actions/deploy-aks-environment
id: deploy
with:
environment_name: pre-production
docker_image: ${{ needs.package.outputs.docker_image }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
deploy_prod:
name: Deploy production environment
runs-on: ubuntu-latest
needs: [deploy_test, package, deploy_preprod]
if: always() && (needs.deploy_preprod.result == 'success' || needs.deploy_preprod.result == 'skipped') && (needs.package.result == 'success') && (needs.deploy_test.result == 'success')
environment: production
concurrency: deploy_production
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/actions/deploy-aks-environment
id: deploy
with:
environment_name: production
docker_image: ${{ needs.package.outputs.docker_image }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}