From 938b1c73c4951687c1ce4cb8a72ca29ef541c513 Mon Sep 17 00:00:00 2001 From: sg Date: Wed, 26 Jun 2024 14:36:33 -0500 Subject: [PATCH] manual with inputs and conditional --- .github/workflows/cdk-deploy-on-merge.yml | 30 ++++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cdk-deploy-on-merge.yml b/.github/workflows/cdk-deploy-on-merge.yml index d78e1e9..5fc0c3b 100644 --- a/.github/workflows/cdk-deploy-on-merge.yml +++ b/.github/workflows/cdk-deploy-on-merge.yml @@ -2,9 +2,15 @@ name: Deploy a CDK stack to dev env with OIDC on: workflow_dispatch: - # push: - # branches: - # - main + inputs: + environment: + description: "AWS environment to deploy to" + type: choice + required: true + default: "dev" + options: + - dev + pull_request: types: - closed @@ -12,20 +18,20 @@ on: - main permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout + id-token: write + contents: read jobs: - # Only run if a pull request is merged - if_merged: - if: github.event.pull_request.merged == true - # Run job for every environment listed in arrary + deploy: + runs-on: ubuntu-latest + strategy: matrix: - # The comma separated array env: [dev] - runs-on: ubuntu-latest - environment: ${{ matrix.env }} + + environment: ${{ github.event.inputs.environment || matrix.env }} + + if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' steps: - name: Checkout Repository