diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml deleted file mode 100644 index d0c4e15..0000000 --- a/.github/workflows/deploy.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Deploy -on: - push: - branches: - - "develop" - - "stage" - - "main" - -permissions: - id-token: write # AWS OIDC - contents: read # Checkout - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Export Env From Branch - run: | - if [[ "$GITHUB_REF_NAME" == "develop" ]]; then - echo "CDK_ENV=dev" >> $GITHUB_ENV - echo "AWS_ROLE_ARN=arn:aws:iam::581184285249:role/github-oidc-role" >> $GITHUB_ENV - elif [[ "$GITHUB_REF_NAME" == "stage" ]]; then - echo "CDK_ENV=stage" >> $GITHUB_ENV - echo "AWS_ROLE_ARN=arn:aws:iam::581184285249:role/github-oidc-role" >> $GITHUB_ENV - elif [[ "$GITHUB_REF_NAME" == "main" ]]; then - echo "CDK_ENV=prod" >> $GITHUB_ENV - echo "AWS_ROLE_ARN=arn:aws:iam::581184285249:role/github-oidc-role" >> $GITHUB_ENV - else - echo "Unknown environment, GITHUB_REF_NAME: $GITHUB_REF_NAME" - exit 1 - fi - - name: Install Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: 'npm' - - name: Install Node - run: npm ci - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ env.AWS_ROLE_ARN }} - aws-region: eu-west-1 - - name: CDK Diff - run: npm run cdk:diff:${{ env.CDK_ENV }} - - name: CDK Deploy - run: npm run cdk:deploy:${{ env.CDK_ENV }} diff --git a/.github/workflows/deploy_develop.yaml b/.github/workflows/deploy_develop.yaml new file mode 100644 index 0000000..6f02754 --- /dev/null +++ b/.github/workflows/deploy_develop.yaml @@ -0,0 +1,35 @@ +name: Deploy Develop +on: + push: + branches: + - "develop" + +permissions: + id-token: write # AWS OIDC + contents: read # Checkout + +env: + FORCE_COLOR: "1" + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - name: Install Node + run: npm ci + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + role-to-assume: arn:aws:iam::581184285249:role/github-oidc-role + aws-region: eu-west-1 + - name: CDK Diff + run: npm run cdk:diff:dev + - name: CDK Deploy + run: npm run cdk:deploy:dev diff --git a/.github/workflows/deploy_production.yaml b/.github/workflows/deploy_production.yaml new file mode 100644 index 0000000..40c7d6a --- /dev/null +++ b/.github/workflows/deploy_production.yaml @@ -0,0 +1,35 @@ +name: Deploy Stage +on: + push: + branches: + - "main" + +permissions: + id-token: write # AWS OIDC + contents: read # Checkout + +env: + FORCE_COLOR: "1" + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - name: Install Node + run: npm ci + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + role-to-assume: arn:aws:iam::581184285249:role/github-oidc-role + aws-region: eu-west-1 + - name: CDK Diff + run: npm run cdk:diff:prod + - name: CDK Deploy + run: npm run cdk:deploy:prod diff --git a/.github/workflows/deploy_stage.yaml b/.github/workflows/deploy_stage.yaml new file mode 100644 index 0000000..c156de7 --- /dev/null +++ b/.github/workflows/deploy_stage.yaml @@ -0,0 +1,35 @@ +name: Deploy Stage +on: + push: + branches: + - "stage" + +permissions: + id-token: write # AWS OIDC + contents: read # Checkout + +env: + FORCE_COLOR: "1" + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install Node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - name: Install Node + run: npm ci + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v3 + with: + role-to-assume: arn:aws:iam::581184285249:role/github-oidc-role + aws-region: eu-west-1 + - name: CDK Diff + run: npm run cdk:diff:stage + - name: CDK Deploy + run: npm run cdk:deploy:stage