Skip to content

Commit

Permalink
Refactor deployment workflows (#1638)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad authored Oct 30, 2024
1 parent 4c41ea5 commit 577a6ec
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 125 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/deploy-dev.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/deploy-prod.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/deploy-test.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
name: Deploy pre-production environment
name: Deploy environment

on:
workflow_call:
inputs:
docker_image:
type: string
required: true

workflow_dispatch:
inputs:
docker_image:
type: string
environment:
type: environment
required: true

concurrency: deploy_pre-production
concurrency: deploy_${{ inputs.environment }}
jobs:
package:
name: Package application
Expand All @@ -27,14 +24,14 @@ jobs:
runs-on: ubuntu-latest

environment:
name: pre-production
name: ${{ inputs.environment }}

steps:
- uses: actions/checkout@v4

- uses: ./.github/workflows/actions/deploy-aks-environment
id: deploy
with:
environment_name: pre-production
environment_name: ${{ inputs.environment }}
docker_image: ${{ inputs.docker_image || needs.package.outputs.docker_image }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}
48 changes: 36 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,50 @@ jobs:
deploy_test:
name: Deploy test environment
runs-on: ubuntu-latest
needs: [package]
uses: ./.github/workflows/deploy-test.yml
with:
docker_image: ${{ needs.package.outputs.docker_image }}
secrets: inherit
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'
uses: ./.github/workflows/deploy-preprod.yml
with:
docker_image: ${{ needs.package.outputs.docker_image }}
secrets: inherit
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')
uses: ./.github/workflows/deploy-prod.yml
with:
docker_image: ${{ needs.package.outputs.docker_image }}
secrets: inherit
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 }}
16 changes: 12 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,16 @@ jobs:

deploy_dev:
name: Deploy dev environment
runs-on: ubuntu-latest
needs: [lint, validate_terraform, tests, package]
uses: ./.github/workflows/deploy-dev.yml
with:
docker_image: ${{ needs.package.outputs.docker_image }}
secrets: inherit
environment: dev
concurrency: deploy_dev
steps:
- uses: actions/checkout@v4

- uses: ./.github/workflows/actions/deploy-aks-environment
id: deploy
with:
environment_name: dev
docker_image: ${{ needs.package.outputs.docker_image }}
azure_credentials: ${{ secrets.AZURE_CREDENTIALS }}

0 comments on commit 577a6ec

Please sign in to comment.