From c7e195f5994f5e60b48996cf49760a68d39299a4 Mon Sep 17 00:00:00 2001 From: seaerchin Date: Mon, 19 Feb 2024 19:08:06 +0800 Subject: [PATCH 1/3] fix(ci): inline prod deploy --- .github/workflows/ci.yml | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f131814f..34fad6a6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -188,19 +188,23 @@ jobs: needs: [gatekeep] if: needs.gatekeep.outputs.proceed == 'true' steps: - - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v3 - with: - node-version: '18.x' - - name: Cache Node.js modules - uses: actions/cache@v2 - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.OS }}-node- - ${{ runner.OS }}- - name: Deploy to ECS - uses: ./.github/workflows/deploy_prod.yml + uses: ./.github/workflows/aws_deploy.yml + with: + aws-region: "ap-southeast-1" + cicd-role: "arn:aws:iam::095733531422:role/isomer-infra-github-oidc-role-16ea937" + ecr-repository: "isomer-infra-prod-ecr" + ecs-cluster-name: "isomer-prod-ecs" + ecs-web-service-name: "isomer-prod-ecs-service" + ecs-container-name: "backend" + environment: "prod" + shortEnv: "prod" + task-definition-path: ".aws/deploy/backend-task-definition.prod.json" + codedeploy-application: "isomer-prod-ecs-app" + codedeploy-deployment-group: "isomer-prod-ecs-dg" + + # Secrets + AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + EFS_FILE_SYSTEM_ID: ${{ secrets.PROD_EFS_FILE_SYSTEM_ID }} + DD_API_KEY: ${{ secrets.DD_API_KEY }} + \ No newline at end of file From 94e72cd2c76cd930c6c1edcaf21dbe2366511b36 Mon Sep 17 00:00:00 2001 From: seaerchin Date: Mon, 19 Feb 2024 19:08:18 +0800 Subject: [PATCH 2/3] 0.66.3 --- CHANGELOG.md | 6 ++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c2018358..0f95eadad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v0.66.3](https://github.com/isomerpages/isomercms-backend/compare/v0.66.2...v0.66.3) + +- fix(ci): inline prod deploy [`c7e195f`](https://github.com/isomerpages/isomercms-backend/commit/c7e195f5994f5e60b48996cf49760a68d39299a4) + #### [v0.66.2](https://github.com/isomerpages/isomercms-backend/compare/v0.66.1...v0.66.2) +> 19 February 2024 + - fix(workflow-:(): add in checkout flow [`f33aca6`](https://github.com/isomerpages/isomercms-backend/commit/f33aca6973f558e14708a572210fa640fab87867) #### [v0.66.1](https://github.com/isomerpages/isomercms-backend/compare/v0.66.0...v0.66.1) diff --git a/package-lock.json b/package-lock.json index f0cce241c..12c2d6ca7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "isomercms", - "version": "0.66.2", + "version": "0.66.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "isomercms", - "version": "0.66.2", + "version": "0.66.3", "dependencies": { "@aws-sdk/client-amplify": "^3.370.0", "@aws-sdk/client-cloudwatch-logs": "^3.370.0", diff --git a/package.json b/package.json index 00fedfe58..d6180c985 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "isomercms", - "version": "0.66.2", + "version": "0.66.3", "private": true, "scripts": { "build": "tsc -p tsconfig.build.json", From a5a225dd203826726ad9f8e39c420bdb4a8e0d2c Mon Sep 17 00:00:00 2001 From: seaerchin Date: Mon, 19 Feb 2024 19:23:42 +0800 Subject: [PATCH 3/3] fix(ci): use workflwo use workflow to run gha fix(workflow): remove additional builds tep fix(secrets): inherit secrest from caller --- .github/workflows/aws_deploy.yml | 8 -------- .github/workflows/ci.yml | 25 +++---------------------- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/.github/workflows/aws_deploy.yml b/.github/workflows/aws_deploy.yml index 860ccb106..73d005178 100644 --- a/.github/workflows/aws_deploy.yml +++ b/.github/workflows/aws_deploy.yml @@ -85,9 +85,7 @@ jobs: - name: Build and push image to ECR uses: docker/build-push-action@v4 with: - provenance: false push: true - sbom: false tags: ${{ steps.login-ecr.outputs.registry }}/${{ inputs.ecr-repository }}:${{ github.sha }} deploy: @@ -111,12 +109,6 @@ jobs: id: login-ecr uses: aws-actions/amazon-ecr-login@v1 - - name: Build and push image to ECR - uses: docker/build-push-action@v4 - with: - push: true - tags: ${{ steps.login-ecr.outputs.registry }}/${{ inputs.ecr-repository }}:${{ github.sha }} - - name: Replace variables in task definition file run: | sed -i 's//${{ secrets.AWS_ACCOUNT_ID }}/g' ${{ inputs.task-definition-path }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34fad6a6a..7b634d1b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,27 +184,8 @@ jobs: # NOTE: Not combining with above workflow to allow parallel execution deploy_ecs: name: Build and deploy to ECS - runs-on: ubuntu-latest needs: [gatekeep] if: needs.gatekeep.outputs.proceed == 'true' - steps: - - name: Deploy to ECS - uses: ./.github/workflows/aws_deploy.yml - with: - aws-region: "ap-southeast-1" - cicd-role: "arn:aws:iam::095733531422:role/isomer-infra-github-oidc-role-16ea937" - ecr-repository: "isomer-infra-prod-ecr" - ecs-cluster-name: "isomer-prod-ecs" - ecs-web-service-name: "isomer-prod-ecs-service" - ecs-container-name: "backend" - environment: "prod" - shortEnv: "prod" - task-definition-path: ".aws/deploy/backend-task-definition.prod.json" - codedeploy-application: "isomer-prod-ecs-app" - codedeploy-deployment-group: "isomer-prod-ecs-dg" - - # Secrets - AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} - EFS_FILE_SYSTEM_ID: ${{ secrets.PROD_EFS_FILE_SYSTEM_ID }} - DD_API_KEY: ${{ secrets.DD_API_KEY }} - \ No newline at end of file + uses: ./.github/workflows/deploy_prod.yml + secrets: inherit + \ No newline at end of file