diff --git a/.github/workflows/express-deploy.yml b/.github/workflows/express-deploy.yml index 8ddd41f..0cee05f 100644 --- a/.github/workflows/express-deploy.yml +++ b/.github/workflows/express-deploy.yml @@ -7,9 +7,9 @@ on: jobs: build: runs-on: ubuntu-latest - # defaults: - # run: - # working-directory: ./packages/slack/ + defaults: + run: + working-directory: ./packages/slack/ steps: - uses: actions/checkout@v3 @@ -19,7 +19,7 @@ jobs: node-version: 18.x - run: yarn - - run: yarn slack build + - run: yarn build - name: Setting .env run: | @@ -59,8 +59,6 @@ jobs: - name: Compress Files run: tar cvfz ./$GITHUB_SHA.gz ./packages/slack/dist - - run: ls -al - - name: Upload to S3 run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.gz s3://${{secrets.AWS_BACKEND_S3_BUCKET}}/deployment/$GITHUB_SHA.gz diff --git a/packages/slack/appspec.yml b/packages/slack/appspec.yml new file mode 100644 index 0000000..ef08deb --- /dev/null +++ b/packages/slack/appspec.yml @@ -0,0 +1,18 @@ +version: 0.0 +os: linux +files: + - source: / + destination: /home/ubuntu/build + overwrite: yes + +permissions: + - object: /home/ubuntu + pattern: '**' + owner: ubuntu + group: ubuntu + +hooks: + AfterInstall: + - location: scripts/after-deploy.sh + timeout: 300 + runas: ubuntu diff --git a/packages/slack/scripts/after-deploy.sh b/packages/slack/scripts/after-deploy.sh new file mode 100644 index 0000000..cd98e8b --- /dev/null +++ b/packages/slack/scripts/after-deploy.sh @@ -0,0 +1,8 @@ +#!/bin/bash +REPOSITORY=/home/ubuntu/build + +cd $REPOSITORY + +sudo yarn + +sudo pm2 start dist