diff --git a/.github/workflows/ci.cd.dev.yml b/.github/workflows/ci.cd.dev.yml new file mode 100644 index 00000000..97426c32 --- /dev/null +++ b/.github/workflows/ci.cd.dev.yml @@ -0,0 +1,23 @@ +name: Deploy +on: + pull_request: + branches: + - develop +jobs: + build: + runs-on: ubuntu-24.04 + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Install dependencies including TypeScript, React, and Vite + run: npm install --save-dev typescript @types/react @types/react-dom vite @vitejs/plugin-react @types/node + working-directory: ./Caecae + + - name: Install other dependencies with Yarn + run: yarn install + working-directory: ./Caecae + + - name: Build project + run: npm run build + working-directory: ./Caecae diff --git a/.github/workflows/ci.cd.prod.yml b/.github/workflows/ci.cd.prod.yml new file mode 100644 index 00000000..c995945d --- /dev/null +++ b/.github/workflows/ci.cd.prod.yml @@ -0,0 +1,45 @@ +name: Deploy +on: + push: + branches: + - main +jobs: + build: + runs-on: ubuntu-24.04 + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Check Node.js version + run: node -v + + - name: Install dependencies including TypeScript, React, and Vite + run: npm install --save-dev typescript @types/react @types/react-dom vite @vitejs/plugin-react @types/node + working-directory: ./Caecae + + - name: Install other dependencies with Yarn + run: yarn install + working-directory: ./Caecae + + - name: Build project + run: npm run build + working-directory: ./Caecae + + - name: Create zip file + run: zip -qq -r ./build.zip . + working-directory: ./Caecae + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + 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://caecae-s3bucket/build.zip + working-directory: ./Caecae + + - name: Deploy with CodeDeploy + run: aws deploy create-deployment --application-name caecae-codeDeploy --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name caecae-codeDeploy-group --s3-location bucket=caecae-s3bucket,bundleType=zip,key=build.zip diff --git a/.gitignore b/.gitignore index 21549b46..35a6946f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,12 @@ # Created by https://www.toptal.com/developers/gitignore/api/react,yarn # Edit at https://www.toptal.com/developers/gitignore?templates=react,yarn +### build file ### +dist + +### webserverKey ### +*.pem + ### react ### .DS_* *.log @@ -151,4 +157,3 @@ dist # temporary folders .tmp/ temp/ - diff --git a/Caecae/.eslintrc.cjs b/Caecae/.eslintrc.cjs index d6c95379..d267197d 100644 --- a/Caecae/.eslintrc.cjs +++ b/Caecae/.eslintrc.cjs @@ -10,6 +10,7 @@ module.exports = { parser: '@typescript-eslint/parser', plugins: ['react-refresh'], rules: { + '@typescript-eslint/no-unused-vars': 'off', 'react-refresh/only-export-components': [ 'warn', { allowConstantExport: true }, diff --git a/Caecae/appspec.yml b/Caecae/appspec.yml new file mode 100644 index 00000000..b65f71c9 --- /dev/null +++ b/Caecae/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/Caecae/deploy.sh b/Caecae/deploy.sh new file mode 100644 index 00000000..b5baadd1 --- /dev/null +++ b/Caecae/deploy.sh @@ -0,0 +1,5 @@ +REPOSITORY=/home/ubuntu/deploy + +cd $REPOSITORY + +sudo service nginx restart diff --git a/Caecae/index.html b/Caecae/index.html index 4f42cb77..f828b817 100644 --- a/Caecae/index.html +++ b/Caecae/index.html @@ -8,6 +8,6 @@
- +