From f9a3248c284e504e407a44a46f3af1729a069418 Mon Sep 17 00:00:00 2001 From: HanSu Lee Date: Tue, 11 Jul 2023 05:00:45 +0900 Subject: [PATCH 1/2] ci: remove ECR/ECS steps --- .github/workflows/publish.yml | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e22278c..3f2ce90 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,10 +6,6 @@ on: env: IMAGE_NAME: ${{ github.repository }} - ECS_TASK_DEFINITION: task-definition.json - ECS_CONTAINER_NAME: frontend - ECS_CLUSTER: hanseithion-cluster - ECS_SERVICE: hanseithion-frontend-services jobs: push_to_registry: @@ -22,17 +18,6 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} - aws-region: ap-northeast-2 - - - name: Log in to Amazon ECR - id: ecr - uses: aws-actions/amazon-ecr-login@v1 - - name: Log in to the Github Container Registry uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 with: @@ -45,7 +30,6 @@ jobs: uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: images: | - ${{ steps.ecr.outputs.registry }}/${{ env.IMAGE_NAME }} ghcr.io/${{ env.IMAGE_NAME }} - name: Build and push Docker image @@ -55,19 +39,3 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - - name: Fill in the new image ID in the Amazon ECS task definition - id: task-def - uses: aws-actions/amazon-ecs-render-task-definition@v1 - with: - task-definition: ${{ env.ECS_TASK_DEFINITION }} - container-name: ${{ env.ECS_CONTAINER_NAME }} - image: ${{ steps.ecr.outputs.registry }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }} - - - name: Deploy Amazon ECS task definition - uses: aws-actions/amazon-ecs-deploy-task-definition@v1 - with: - task-definition: ${{ steps.task-def.outputs.task-definition }} - cluster: ${{ env.ECS_CLUSTER }} - service: ${{ env.ECS_SERVICE }} - wait-for-service-stability: true From a051796a9eb9ea8862de8e837dd3bcb8159d6355 Mon Sep 17 00:00:00 2001 From: HanSu Lee Date: Tue, 11 Jul 2023 05:07:22 +0900 Subject: [PATCH 2/2] ci: add deploy to amplify jobs on release --- .github/workflows/{publish.yml => release.yml} | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) rename .github/workflows/{publish.yml => release.yml} (77%) diff --git a/.github/workflows/publish.yml b/.github/workflows/release.yml similarity index 77% rename from .github/workflows/publish.yml rename to .github/workflows/release.yml index 3f2ce90..7b8cf11 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Publish Docker Image +name: Release on: release: @@ -39,3 +39,12 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + deploy_to_amplify: + name: Request Amplify Deploy + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Send request to Amplify deploy webhook + run: curl -X POST -d {} ${{ secrets.AMPLIFY_DEPLOY_WEBHOOK }} -H "Content-Type:application/json"