From 3baccc8a6812715bafe44536d267652e35fa62e2 Mon Sep 17 00:00:00 2001 From: Ariling <97501226+Ariling@users.noreply.github.com> Date: Wed, 7 Feb 2024 16:36:03 +0900 Subject: [PATCH] =?UTF-8?q?setting,test=20:=20CI/CD=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 37 ++++++++++++++++++++++++++++++++++++ appspec.yml | 16 ++++++++++++++++ deploy.sh | 7 +++++++ 3 files changed, 60 insertions(+) create mode 100644 .github/workflows/deploy.yml create mode 100644 appspec.yml create mode 100644 deploy.sh diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..42964f7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,37 @@ +name: Deploy +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout source code. + uses: actions/checkout@v2 + - name: Check Node v + run: node -v + - name: Install Dependencies + run: yarn install --frozen-lockfile + - name: Build + run: yarn build + env: + NEXT_PUBLIC_SERVER_URL: ${{ secrets.NEXT_PUBLIC_SERVER_URL }} + - name: zip create + run: zip -qq -r ./build.zip . + shell: bash + - 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_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Upload to S3 + run: | + aws s3 cp --region ap-northeast-2 ./build.zip s3://floud-bucket/build.zip + - name: Deploy + run: aws deploy create-deployment + --application-name flouD-codeDeploy + --deployment-config-name CodeDeployDefault.AllAtOnce + --deployment-group-name flouD-codeDeploy-group + --s3-location bucket=floud-bucket,bundleType=zip,key=build.zip diff --git a/appspec.yml b/appspec.yml new file mode 100644 index 0000000..b65f71c --- /dev/null +++ b/appspec.yml @@ -0,0 +1,16 @@ +version: 0.0 +os: linux +files: + - source: / + destination: /home/ubuntu/deploy + overwrite: yes +permissions: + - object: /home/ubuntu/deploy + owner: root + group: root + mode: 755 +hooks: + AfterInstall: + - location: deploy.sh + timeout: 1000 + runas: root diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..808000f --- /dev/null +++ b/deploy.sh @@ -0,0 +1,7 @@ +REPOSITORY=/home/ubuntu/deploy + +cd $REPOSITORY + +sudo npm install next + +sudo pm2 reload all \ No newline at end of file