Skip to content

Commit

Permalink
Merge pull request #51 from Happy-HOBAK/chore/#47
Browse files Browse the repository at this point in the history
[#50] EB ๊ด€๋ จ ํŒŒ์ผ ์‚ญ์ œ ๋ฐ CI/CD ํŒŒ์ผ ์ˆ˜์ •
  • Loading branch information
yel-m authored May 5, 2024
2 parents 1f49157 + 11ff596 commit eed151d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 48 deletions.
12 changes: 0 additions & 12 deletions .ebextensions/00-makeFiles.config

This file was deleted.

3 changes: 0 additions & 3 deletions .ebextensions/01-set-timezone.config

This file was deleted.

52 changes: 20 additions & 32 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ name: HappinesSQL CI/CD

# 2. ์›Œํฌํ”Œ๋กœ๊ฐ€ ์‹œ์ž‘๋  ์กฐ๊ฑด ์ง€์ •
on:
push:
branches: [ develop ]
pull_request:
types: [ closed ]
workflow_dispatch:
branches: [ develop ]
# workflow_dispatch:

env:
S3_BUCKET_NAME: happinessql-deploy
PROJECT_NAME: happinessql

jobs:
build:
runs-on: ubuntu-latest # 3. ์‹คํ–‰ ํ™˜๊ฒฝ ์ง€์ •
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'
# if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'

# 4. ์‹คํ–‰ ์Šคํ… ์ง€์ •
steps:
Expand All @@ -27,17 +33,6 @@ jobs:
run: chmod +x ./gradlew
shell: bash # ๊ถŒํ•œ ๋ถ€์—ฌ

- name: Set Environment
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yml
env:
cloud.aws.credentials.access-key: ${{ secrets.AWS_S3_ACCESS_KEY }}
cloud.aws.credentials.secret-key: ${{ secrets.AWS_S3_SECRET_KEY }}
spring.datasource.url: ${{ secrets.DB_URL }}
spring.datasource.username: ${{ secrets.DB_USER }}
spring.datasource.password: ${{ secrets.DB_PASSWORD }}

- name: Build with Gradle
run: ./gradlew clean build -x test
shell: bash # build ์‹œ์ž‘
Expand All @@ -53,23 +48,16 @@ jobs:
run: echo "CurrentTime=$"
shell: bash # ํ™•๋ณดํ•œ ์‹œ๊ฐ„ ๋ณด์—ฌ์ฃผ๊ธฐ

- name: Generate deployment package
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .
- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash

- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v20
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }}
application_name: happinessql-dev
environment_name: Happinessql-dev-env
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
region: ap-northeast-2
deployment_package: deploy/deploy.zip
wait_for_deployment: false
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 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

0 comments on commit eed151d

Please sign in to comment.