diff --git a/.github/workflows/aws-deploy.yaml b/.github/workflows/aws-deploy.yaml index 46b3d7d..abf12bd 100644 --- a/.github/workflows/aws-deploy.yaml +++ b/.github/workflows/aws-deploy.yaml @@ -24,7 +24,6 @@ on: environment: required: true type: string - default: "dev" secrets-location: type: string default: "local" @@ -38,8 +37,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - ref: ${{ inputs.environment }} - name: Install AWS CLI run: sudo snap install aws-cli --classic - name: Install AWS CDK CLI diff --git a/.github/workflows/deploy-prod.yaml b/.github/workflows/deploy-prod.yaml index f2c1b60..7190c87 100644 --- a/.github/workflows/deploy-prod.yaml +++ b/.github/workflows/deploy-prod.yaml @@ -1,15 +1,14 @@ name: deploy-prod on: - workflow_run: - workflows: - - check - types: - - completed - branches: - - prod + push: + branches: ['prod'] jobs: + test: + uses: ./.github/workflows/test.yaml + with: + environment: prod aws-deploy: uses: "./.github/workflows/aws-deploy.yaml" with: diff --git a/.github/workflows/deploy-stage.yaml b/.github/workflows/deploy-stage.yaml index 8ace4da..a944f55 100644 --- a/.github/workflows/deploy-stage.yaml +++ b/.github/workflows/deploy-stage.yaml @@ -1,15 +1,14 @@ name: deploy-stage on: - workflow_run: - workflows: - - check - types: - - completed - branches: - - stage + push: + branches: ['stage'] jobs: + test: + uses: ./.github/workflows/test.yaml + with: + environment: stage aws-deploy: uses: "./.github/workflows/aws-deploy.yaml" with: diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..8921afe --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,11 @@ +name: pr-check + +on: + pull_request: + branches: ['*'] + +jobs: + test: + uses: ./.github/workflows/test.yaml + with: + environment: dev diff --git a/.github/workflows/check.yml b/.github/workflows/test.yaml similarity index 79% rename from .github/workflows/check.yml rename to .github/workflows/test.yaml index 07cc2c6..e91c8b6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/test.yaml @@ -1,11 +1,11 @@ -name: check +name: test on: - pull_request: - branches: ['*'] - push: - branches: ['*'] - + workflow_call: + inputs: + environment: + required: true + type: string jobs: unit-tests: runs-on: ubuntu-latest @@ -25,6 +25,9 @@ jobs: run: pip install -r requirements.txt -r requirements-dev.txt - name: Generate cloudformation uses: youyo/aws-cdk-github-actions@v2 + env: + ENV: ${{ inputs.environment }} + secrets-location: "ssm" with: cdk_subcommand: 'synth' actions_comment: false