diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 573574a..7e3a900 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -76,7 +76,7 @@ jobs: - name: Stop container run: docker stop fruit-api-test - + push-image: needs: build-and-test runs-on: ubuntu-latest @@ -92,4 +92,23 @@ jobs: - name: Build and push image run: | docker build -t ghcr.io/${{ github.repository_owner }}/fruit-api:latest ./fruit-api - docker push ghcr.io/${{ github.repository_owner }}/fruit-api:latest \ No newline at end of file + docker push ghcr.io/${{ github.repository_owner }}/fruit-api:latest + + deploy: + needs: push-image + runs-on: ubuntu-latest + steps: + - 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: eu-west-1 + + - name: Deploy to ECS + run: | + aws ecs update-service \ + --cluster fruit-api-cluster \ + --service fruit-api-service \ + --force-new-deployment + \ No newline at end of file