From 9a0400b16fcb44742c8d848349e95267f5c11d2e Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Tue, 10 Sep 2024 02:10:07 +0900 Subject: [PATCH 01/27] chore: added config file to gitignore --- backend/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/.gitignore b/backend/.gitignore index 92d69ffb0..b81b58102 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -7,6 +7,7 @@ build/ **/src/main/resources/static/docs/ src/main/resources/env.properties +env*.properties ### STS ### .apt_generated From 33eabcb3f8f4b77709ea5661d983fb752582ca38 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Tue, 10 Sep 2024 02:10:32 +0900 Subject: [PATCH 02/27] feat: dev docker compose file --- backend/{docker => }/docker-compose.dev.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) rename backend/{docker => }/docker-compose.dev.yml (64%) diff --git a/backend/docker/docker-compose.dev.yml b/backend/docker-compose.dev.yml similarity index 64% rename from backend/docker/docker-compose.dev.yml rename to backend/docker-compose.dev.yml index 3d8473708..3ae774378 100644 --- a/backend/docker/docker-compose.dev.yml +++ b/backend/docker-compose.dev.yml @@ -2,7 +2,7 @@ version: '3' services: mysql: - container_name: zipgo + container_name: zipgo-mysql image: mysql/mysql-server environment: MYSQL_DATABASE: zipgo-mysql @@ -10,9 +10,14 @@ services: MYSQL_ROOT_PASSWORD: root TZ: 'Asia/Seoul' ports: - - 13306:3306 + - "13306:3306" command: - "mysqld" - "--character-set-server=utf8mb4" - "--collation-server=utf8mb4_unicode_ci" - + springboot: + container_name: zipgo-backend + build: . + env_file: "env.dev.properties" + ports: + - "8080:8080" From 9e0786ddab958d77692ffba180f3f9142a653654 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 17:43:22 +0900 Subject: [PATCH 03/27] feat: workflow for pushing alpha image --- .../workflows/backend-build-alpha-image.yml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/backend-build-alpha-image.yml diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml new file mode 100644 index 000000000..c55c0752a --- /dev/null +++ b/.github/workflows/backend-build-alpha-image.yml @@ -0,0 +1,36 @@ +name: Build Alpha Image + +on: + # push: + pull_request: + branches: [ develop ] + paths: backend/** + +jobs: + build: + defaults: + run: + working-directory: backend + runs-on: ubuntu-latest + + steps: + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section + with: + role-to-assume: arn:aws:iam::791335373803:role/AWSPushImageToECR + aws-region: ap-northeast-2 + + - name: Amazon ECR "Login" Action for GitHub Actions + uses: aws-actions/amazon-ecr-login@v2.0.1 + + - name: Build Image + run: docker build . + + - name: push ECR + env: + REGISTRY: ${{ steps.login-ecr.outputs.registry }} + REPOSITORY: my-ecr-repo + IMAGE_TAG: ${{ github.sha }} + run: | + docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . + docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG \ No newline at end of file From 1dddb1d36f3e5f6cefeb270f9ac258985290dcc1 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 17:46:36 +0900 Subject: [PATCH 04/27] fix: add missing field 'id-token' --- .github/workflows/backend-build-alpha-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index c55c0752a..dbaf59159 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -5,14 +5,14 @@ on: pull_request: branches: [ develop ] paths: backend/** - +permissions: + id-token: write jobs: build: defaults: run: working-directory: backend runs-on: ubuntu-latest - steps: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section From 88e4fc0226ea8a0d9248ee069867e55f0b4c7b09 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 18:19:47 +0900 Subject: [PATCH 05/27] fix: fields --- .github/workflows/backend-build-alpha-image.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index dbaf59159..0eef0764e 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -24,12 +24,14 @@ jobs: uses: aws-actions/amazon-ecr-login@v2.0.1 - name: Build Image - run: docker build . + run: | + cd backend + docker build . - name: push ECR env: REGISTRY: ${{ steps.login-ecr.outputs.registry }} - REPOSITORY: my-ecr-repo + REPOSITORY: zipgo/alpha-backend IMAGE_TAG: ${{ github.sha }} run: | docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . From 7b4df49c821753e473c4a4beab5ba2cdd80aeaee Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 18:32:05 +0900 Subject: [PATCH 06/27] fix: added checkout --- .github/workflows/backend-build-alpha-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index 0eef0764e..cd918528e 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -14,6 +14,7 @@ jobs: working-directory: backend runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section with: From 7ce235ec46b3c65081e23d803f27d318d6e2b871 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 18:35:57 +0900 Subject: [PATCH 07/27] undo cd command --- .github/workflows/backend-build-alpha-image.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index cd918528e..4a8e4b988 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -25,9 +25,7 @@ jobs: uses: aws-actions/amazon-ecr-login@v2.0.1 - name: Build Image - run: | - cd backend - docker build . + run: docker build . - name: push ECR env: From 357451130d532305ffbf17f0853cc1f429d108ce Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 18:38:23 +0900 Subject: [PATCH 08/27] fix: added build job --- .github/workflows/backend-build-alpha-image.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index 4a8e4b988..f0e686986 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -9,6 +9,23 @@ permissions: id-token: write jobs: build: + defaults: + run: + working-directory: backend + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + push-image: defaults: run: working-directory: backend From 1451f50d80a7e123d08cdc68316846b62e6ca5a8 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 18:39:35 +0900 Subject: [PATCH 09/27] fix: added dependency between jobs --- .github/workflows/backend-build-alpha-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index f0e686986..d9f4f3a0b 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -26,6 +26,7 @@ jobs: - name: Build with Gradle run: ./gradlew build push-image: + needs: build defaults: run: working-directory: backend From b334660dd3f91bf3a032e50e9a1d64164a0d140e Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 18:44:49 +0900 Subject: [PATCH 10/27] add pwd --- .github/workflows/backend-build-alpha-image.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index d9f4f3a0b..17af58e76 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -33,6 +33,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: Build Image + run: | + pwd + docker build . - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section with: @@ -41,9 +45,6 @@ jobs: - name: Amazon ECR "Login" Action for GitHub Actions uses: aws-actions/amazon-ecr-login@v2.0.1 - - - name: Build Image - run: docker build . - name: push ECR env: From 63e7e34226e72909f1346307d53f869f772c69df Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 19:12:53 +0900 Subject: [PATCH 11/27] feat: combine steps --- .../workflows/backend-build-alpha-image.yml | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index 17af58e76..7b441d894 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -8,35 +8,25 @@ on: permissions: id-token: write jobs: - build: - defaults: - run: - working-directory: backend - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Set up JDK 17 - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'adopt' - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build push-image: - needs: build defaults: run: working-directory: backend runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + - uses: actions/checkout@v3 - name: Build Image - run: | - pwd - docker build . + run: docker build . - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section with: From ffe3badefb521dabcecc2de9837500ef4e695afe Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 19:20:28 +0900 Subject: [PATCH 12/27] check build file --- .github/workflows/backend-build-alpha-image.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index 7b441d894..669f4adc7 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -24,6 +24,8 @@ jobs: run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build + - name: check jar file + run: ls -l build/libs - uses: actions/checkout@v3 - name: Build Image run: docker build . From 35071b5d7410884b74d2f8282e20e0a21f57262c Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 19:25:50 +0900 Subject: [PATCH 13/27] fix: removed duplicate checkout step --- .github/workflows/backend-build-alpha-image.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index 669f4adc7..6b464705a 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -26,7 +26,6 @@ jobs: run: ./gradlew build - name: check jar file run: ls -l build/libs - - uses: actions/checkout@v3 - name: Build Image run: docker build . - name: Configure AWS credentials From 2bf1342c198f178837f9ee7577a037034ef9d61d Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 12 Sep 2024 19:34:20 +0900 Subject: [PATCH 14/27] fix: added step id --- .github/workflows/backend-build-alpha-image.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index 6b464705a..47865d56f 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -35,6 +35,7 @@ jobs: aws-region: ap-northeast-2 - name: Amazon ECR "Login" Action for GitHub Actions + id: login-ecr uses: aws-actions/amazon-ecr-login@v2.0.1 - name: push ECR From 0e4e7757254465309d770cb675434ed83c156ee3 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Wed, 18 Sep 2024 02:43:43 +0900 Subject: [PATCH 15/27] feat: continuous deployment --- .github/workflows/backend-build-alpha-image.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index 47865d56f..e91aa0805 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -45,4 +45,16 @@ jobs: IMAGE_TAG: ${{ github.sha }} run: | docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . - docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG \ No newline at end of file + docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG + + - name: Docker Login + run: | + aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_LOGIN_PASSWORD }} + - name: CD on EC2 + uses: zip-go/aws-ssm-action@v1.0.0 + instanceName: ${{ secrets.ALPHA_INSTANCE_NAME }} + workingDirectory: ${{ secrets.ALPHA_WORKING_DIRECTORY }} + command: | + rm .env + echo IMAGE_TAG=${{ github.sha }} > .env + docker compose restart zipgo-backend \ No newline at end of file From 81af5062c80d4ab7a5a086f09a70ca55384776d2 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Wed, 18 Sep 2024 02:49:41 +0900 Subject: [PATCH 16/27] chore: changed workflow trigger --- .github/workflows/backend-build-alpha-image.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index e91aa0805..9859af5e1 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -1,8 +1,7 @@ name: Build Alpha Image on: - # push: - pull_request: + push: branches: [ develop ] paths: backend/** permissions: @@ -29,7 +28,7 @@ jobs: - name: Build Image run: docker build . - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 # More information on this action can be found below in the 'AWS Credentials' section + uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: arn:aws:iam::791335373803:role/AWSPushImageToECR aws-region: ap-northeast-2 From a34610906cebe007402ae564f427cc8cd750f254 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Mon, 14 Oct 2024 22:04:41 +0900 Subject: [PATCH 17/27] feat: separated alpha cd workflow --- .github/workflows/frontend-deploy-dev.yml | 33 +++++++++-------------- backend/docker-compose.dev.yml | 2 ++ frontend/.env.development | 2 +- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index 22dd7f7d2..323876267 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -1,6 +1,7 @@ name: Frontend Deploy to Dev on: + pull_request: push: branches: - develop @@ -58,29 +59,19 @@ jobs: context: ./frontend file: ./frontend/Dockerfile.dev push: true - tags: ${{ secrets.FRONTEND_IMAGE_NAME }}:latest + tags: ${{ secrets.FRONTEND_ALPHA_IMAGE_NAME }}:latest platforms: | linux/amd64 linux/arm64 - deploy-to-develop-EC2: - needs: build-dockerfile - runs-on: front-dev-server - - steps: - - name: Deploy to Develop EC2 - run: | - docker stop ${{ secrets.FRONTEND_CONTAINER_NAME }} || true - docker rm ${{ secrets.FRONTEND_CONTAINER_NAME }} || true - docker pull ${{ secrets.FRONTEND_IMAGE_NAME }}:latest - docker run -d -p 3000:3000 --name ${{ secrets.FRONTEND_CONTAINER_NAME }} ${{ secrets.FRONTEND_IMAGE_NAME }}:latest - - - name: Slack Notification - uses: 8398a7/action-slack@v3 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 with: - status: ${{ job.status }} - author_name: 프론트엔드 배포 알림 - fields: repo,message,commit,author,action,eventName,ref,workflow,job,took - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: always() + role-to-assume: arn:aws:iam::791335373803:role/SendCommandToEc2FromGithub + aws-region: ${{ secrets.AWS_REGION }} + - name: CD on EC2 + uses: zip-go/aws-ssm-action@v1.0.0 + instanceName: ${{ secrets.ALPHA_INSTANCE_NAME }} + workingDirectory: ${{ secrets.ALPHA_WORKING_DIRECTORY }} + command: | + docker compose restart zipgo-frontend \ No newline at end of file diff --git a/backend/docker-compose.dev.yml b/backend/docker-compose.dev.yml index 3ae774378..38462a15a 100644 --- a/backend/docker-compose.dev.yml +++ b/backend/docker-compose.dev.yml @@ -21,3 +21,5 @@ services: env_file: "env.dev.properties" ports: - "8080:8080" + depends_on: + - mysql diff --git a/frontend/.env.development b/frontend/.env.development index 750405545..cb0050c73 100644 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -1,3 +1,3 @@ FAST_REFRESH=true -BASE_URL=https://dev.api.zipgo.pet +BASE_URL=http://zipgo-backend HOMEPAGE=https://dev.zipgo.pet From 52104d3169aba157037e0376d43ba0989a03df5e Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Mon, 14 Oct 2024 22:13:03 +0900 Subject: [PATCH 18/27] test: trigger pr test --- .github/workflows/frontend-deploy-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index 323876267..839bdeb6e 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -1,8 +1,8 @@ name: Frontend Deploy to Dev on: - pull_request: push: + pull_request: branches: - develop paths: From 2654cc0d7329a13e20fcf11a2359dba929414f89 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Mon, 14 Oct 2024 22:17:26 +0900 Subject: [PATCH 19/27] fix: workflow trigger branches --- .github/workflows/frontend-deploy-dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index 839bdeb6e..893d47cac 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -3,8 +3,7 @@ name: Frontend Deploy to Dev on: push: pull_request: - branches: - - develop + branches: [main, develop] paths: - frontend/** - .github/** From 5f1742bb74d4a8dfc78ff8531d68fbecc3a21359 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Mon, 14 Oct 2024 22:19:56 +0900 Subject: [PATCH 20/27] fix: workflow trigger grammar --- .github/workflows/frontend-deploy-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index 893d47cac..9d9d8f5ff 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -1,7 +1,7 @@ name: Frontend Deploy to Dev on: - push: + # push: pull_request: branches: [main, develop] paths: From 1060a764d5f0ef6287bd91b07614d64f450b35e8 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Mon, 14 Oct 2024 22:23:04 +0900 Subject: [PATCH 21/27] fix: workflow trigger grammar --- .github/workflows/frontend-deploy-dev.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index 9d9d8f5ff..051f12de7 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -4,9 +4,7 @@ on: # push: pull_request: branches: [main, develop] - paths: - - frontend/** - - .github/** + paths: [frontend/**, .github/**] jobs: build-dockerfile: From eba28b572215110486e26c02269c64cca903a7aa Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Mon, 14 Oct 2024 22:27:48 +0900 Subject: [PATCH 22/27] fix: workflow trigger grammar --- .github/workflows/frontend-deploy-dev.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index 051f12de7..e7a1ff60d 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -1,10 +1,13 @@ name: Frontend Deploy to Dev on: - # push: pull_request: - branches: [main, develop] - paths: [frontend/**, .github/**] + branches: + - main + - develop + paths: + - 'frontend/**' + - '.github/**' jobs: build-dockerfile: From 98b48a90018053ba27eac4accb1a3e86a10e8226 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Tue, 15 Oct 2024 23:43:56 +0900 Subject: [PATCH 23/27] fix: action trigger event --- .github/workflows/frontend-deploy-dev.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index e7a1ff60d..e0e8d88ef 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -1,14 +1,19 @@ name: Frontend Deploy to Dev on: + push: + branches: + - develop + paths: + - frontend/** + - .github/** pull_request: branches: - - main - develop paths: - - 'frontend/**' - - '.github/**' - + - frontend/** + - .github/** + jobs: build-dockerfile: defaults: From ca8e52d7c7928e1ffbc9921c8d94493c5348d4a6 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Wed, 16 Oct 2024 14:22:53 +0900 Subject: [PATCH 24/27] chore: added target-branch --- .github/workflows/frontend-deploy-dev.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index e0e8d88ef..d4d8f4905 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -4,6 +4,7 @@ on: push: branches: - develop + - feat/alpha-env paths: - frontend/** - .github/** @@ -13,7 +14,7 @@ on: paths: - frontend/** - .github/** - + jobs: build-dockerfile: defaults: From 1b68a14a8106eb2768be2f42f2bc1e750ad90121 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Wed, 16 Oct 2024 14:43:50 +0900 Subject: [PATCH 25/27] chore: temporarily removed other workflows --- .github/workflows/frontend-deploy-dev.yml | 6 ------ .github/workflows/gradle.yml | 6 +++--- .github/workflows/storybook.yml | 6 +++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index d4d8f4905..65853cfdb 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -8,12 +8,6 @@ on: paths: - frontend/** - .github/** - pull_request: - branches: - - develop - paths: - - frontend/** - - .github/** jobs: build-dockerfile: diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b6a662d58..52cd8608c 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -4,9 +4,9 @@ on: push: branches: [ main, develop ] paths: backend/** - pull_request: - branches: [ main, develop ] - paths: backend/** + # pull_request: + # branches: [ main, develop ] + # paths: backend/** jobs: build: diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml index 7f6622ef1..53509f90b 100644 --- a/.github/workflows/storybook.yml +++ b/.github/workflows/storybook.yml @@ -4,9 +4,9 @@ on: push: branches: [main, develop] paths: frontend/** - pull_request: - branches: [main, develop] - paths: frontend/** + # pull_request: + # branches: [main, develop] + # paths: frontend/** jobs: storybook-test: From 0f4830464dc31cf26906d3385028f8871e3e54c2 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Wed, 16 Oct 2024 14:51:11 +0900 Subject: [PATCH 26/27] fix: action argument --- .github/workflows/backend-build-alpha-image.yml | 13 +++++++------ .github/workflows/frontend-deploy-dev.yml | 9 +++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/backend-build-alpha-image.yml b/.github/workflows/backend-build-alpha-image.yml index 9859af5e1..d01d65e93 100644 --- a/.github/workflows/backend-build-alpha-image.yml +++ b/.github/workflows/backend-build-alpha-image.yml @@ -51,9 +51,10 @@ jobs: aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.ECR_LOGIN_PASSWORD }} - name: CD on EC2 uses: zip-go/aws-ssm-action@v1.0.0 - instanceName: ${{ secrets.ALPHA_INSTANCE_NAME }} - workingDirectory: ${{ secrets.ALPHA_WORKING_DIRECTORY }} - command: | - rm .env - echo IMAGE_TAG=${{ github.sha }} > .env - docker compose restart zipgo-backend \ No newline at end of file + with: + instanceName: ${{ secrets.ALPHA_INSTANCE_NAME }} + workingDirectory: ${{ secrets.ALPHA_WORKING_DIRECTORY }} + commands: | + rm .env + echo IMAGE_TAG=${{ github.sha }} > .env + docker compose restart zipgo-backend \ No newline at end of file diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index 65853cfdb..8239af89c 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -71,7 +71,8 @@ jobs: aws-region: ${{ secrets.AWS_REGION }} - name: CD on EC2 uses: zip-go/aws-ssm-action@v1.0.0 - instanceName: ${{ secrets.ALPHA_INSTANCE_NAME }} - workingDirectory: ${{ secrets.ALPHA_WORKING_DIRECTORY }} - command: | - docker compose restart zipgo-frontend \ No newline at end of file + with: + instanceName: ${{ secrets.ALPHA_INSTANCE_NAME }} + workingDirectory: ${{ secrets.ALPHA_WORKING_DIRECTORY }} + commands: | + docker compose restart zipgo-frontend \ No newline at end of file From 08617803815f0aad1a30a96456371e3776d13395 Mon Sep 17 00:00:00 2001 From: Kayoung Yoon Date: Thu, 31 Oct 2024 13:23:06 +0900 Subject: [PATCH 27/27] add id-token permission for OIDC --- .github/workflows/frontend-deploy-dev.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/frontend-deploy-dev.yml b/.github/workflows/frontend-deploy-dev.yml index 8239af89c..24f07a1b5 100644 --- a/.github/workflows/frontend-deploy-dev.yml +++ b/.github/workflows/frontend-deploy-dev.yml @@ -8,7 +8,8 @@ on: paths: - frontend/** - .github/** - +permissions: + id-token: write jobs: build-dockerfile: defaults: @@ -75,4 +76,5 @@ jobs: instanceName: ${{ secrets.ALPHA_INSTANCE_NAME }} workingDirectory: ${{ secrets.ALPHA_WORKING_DIRECTORY }} commands: | - docker compose restart zipgo-frontend \ No newline at end of file + docker compose restart zipgo-frontend + echo "Succeeded: $GITHUB_SHA" > result.txt \ No newline at end of file