diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 562bc817..85988e7a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,7 @@ jobs: version: 61.${{ github.run_number }}.${{ github.run_attempt }} java_version: 21 java_distribution: "corretto" + build-docker: name: Build Docker uses: ./.github/workflows/build-docker.yml @@ -27,7 +28,8 @@ jobs: aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }} docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }} docker_hub_password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - needs: [build-maven] + needs: [ build-maven ] + cdk-diff-stage: if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/') name: CDK diff to Stage @@ -36,7 +38,8 @@ jobs: environment: "stage" secrets: aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }} - needs: [ build-maven ] + needs: [ build-maven, build-docker ] + cdk-deploy-stage: if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/') name: CDK deploy to Stage @@ -45,14 +48,26 @@ jobs: environment: "stage" secrets: aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }} - needs: [cdk-diff-stage, build-docker] + needs: [ cdk-diff-stage ] + eks-deploy-stage: if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/hotfix/') name: EKS deploy to Stage uses: ./.github/workflows/eks-deploy.yml with: environment: "stage" - needs: [cdk-diff-stage, build-docker, cdk-deploy-stage] + needs: [ cdk-deploy-stage ] + + cdk-diff-prod: + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/') + name: CDK diff to Prod + uses: ./.github/workflows/cdk-diff.yml + with: + environment: "prod" + secrets: + aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }} + needs: [ build-maven, build-docker ] + cdk-deploy-prod: if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/') name: CDK deploy to Prod @@ -61,7 +76,8 @@ jobs: environment: "prod" secrets: aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }} - needs: [cdk-diff-stage, build-docker] + needs: [ cdk-diff-prod ] + eks-deploy-prod: if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/hotfix/') name: EKS deploy to Prod @@ -70,4 +86,4 @@ jobs: environment: "prod" secrets: aws_assume_role: ${{ secrets.AWS_ASSUME_ROLE }} - needs: [cdk-deploy-prod] + needs: [ cdk-deploy-prod ] diff --git a/.github/workflows/cdk-deploy.yml b/.github/workflows/cdk-deploy.yml index eed8321d..2874532d 100644 --- a/.github/workflows/cdk-deploy.yml +++ b/.github/workflows/cdk-deploy.yml @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-latest container: # Replace with GitHub action in the future image: public.ecr.aws/truemark/aws-cdk:ubuntu + environment: ${{ inputs.environment }} steps: - uses: actions/checkout@v4