diff --git a/.github/workflows/build-and-publish.yaml b/.github/workflows/build-and-publish.yaml index 997185d..04250e7 100644 --- a/.github/workflows/build-and-publish.yaml +++ b/.github/workflows/build-and-publish.yaml @@ -1,5 +1,4 @@ -name: Build and Publish Docker image - +name: "Build and Publish Docker image" on: push: branches: [main] @@ -7,7 +6,6 @@ on: workflows: ["Lint and Test"] types: - completed - jobs: build-and-publish: if: ${{ github.event.workflow_run.conclusion == 'success' }} diff --git a/.github/workflows/deploy-lambda.yaml b/.github/workflows/deploy-lambda.yaml index c78bea1..f276c7d 100644 --- a/.github/workflows/deploy-lambda.yaml +++ b/.github/workflows/deploy-lambda.yaml @@ -1,17 +1,12 @@ -name: Deploy AWS Lambda - +name: "Deploy AWS Lambda" on: pull_request: types: [closed] branches: [main] - - - jobs: deploy-lambda: if: ${{ github.event.pull_request.merged == true }} runs-on: ubuntu-latest - steps: - name: Check out Git repository uses: actions/checkout@v4 diff --git a/.github/workflows/deploy-to-ecs.yaml b/.github/workflows/deploy-to-ecs.yaml new file mode 100644 index 0000000..4934872 --- /dev/null +++ b/.github/workflows/deploy-to-ecs.yaml @@ -0,0 +1,20 @@ +name: "Deploy container to AWS ECS" +on: + pull_request: + types: [closed] + branches: [main] +jobs: + deploy-to-ecs: + runs-on: ubuntu-latest + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_DEFAULT_REGION }} + - name: Deploy to ECS + run: | + aws ecs update-service --cluster ${{ secrets.ECS_CLUSTER }} --service ${{ secrets.ECS_SERVICE }} --force-new-deployment \ No newline at end of file