Skip to content

Merge pull request #155 from KUDDY-2023/feature/133-spot #119

Merge pull request #155 from KUDDY-2023/feature/133-spot

Merge pull request #155 from KUDDY-2023/feature/133-spot #119

Workflow file for this run

name: kuddy-server
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "develop" ]
env: # ν˜„μž¬ μŠ€ν¬λ¦½νŠΈμ—μ„œ μ‚¬μš©ν•  ν™˜κ²½λ³€μˆ˜ μ •μ˜
S3_BUCKET_NAME: onezerobucket
PROJECT_NAME: kuddy-server
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout # 깃헙이 μ œκ³΅ν•˜λŠ” μ›Œν¬μŠ€νŽ˜μ΄μŠ€ (이 workflow λ₯Ό μ‹€ν–‰ν•˜λŠ” 곡간) μ—μ„œ λ‚΄ μ €μž₯μ†Œκ°€ μœ„μΉ˜ν•œ 곳으둜 이동
uses: actions/checkout@v3
- name: Set up JDK 11 # java μ…‹μ—…
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
- name: Grant execute permission for gradlew # gradlew에 μ‹€ν–‰κΆŒν•œ
run: chmod +x ./gradlew
shell: bash
- name: Decode application.yml for api-server
run: echo "${{ secrets.API_APPLICATION }}" | base64 -d > ./api-server/src/main/resources/application.yml
- name: Decode application.yml for chat-server
run: echo "${{ secrets.CHAT_APPLICATION }}" | base64 -d > ./chat-server/src/main/resources/application.yml
- name: Decode application.yml for noti-server
run: echo "${{ secrets.NOTI_APPLICATION }}" | base64 -d > ./noti-server/src/main/resources/application.yml
- name: Build with Gradle # ν”„λ‘œμ νŠΈ build
run: ./gradlew clean build -x test
shell: bash
- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash
- 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 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip
- name: Code Deploy
run: aws deploy create-deployment --application-name $PROJECT_NAME --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name $PROJECT_NAME --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip