Skip to content

Commit

Permalink
Merge pull request #20 from Tune-Fun/configuration/workflow/cd
Browse files Browse the repository at this point in the history
config(workflow): cd
  • Loading branch information
habinkim authored Mar 7, 2024
2 parents c611cb1 + d8b9dad commit 5a1a502
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# workflow의 이름
name: CD

# 해당 workflow가 언제 실행될 것인지에 대한 트리거를 지정
on:
push:
branches: [ develop ] # main branch로 push 될 때 실행됩니다.

# 해당 yml 내에서 사용할 key - value
env:
S3_BUCKET_NAME: tuenfun-dev-deploy

# workflow는 한개 이상의 job을 가지며, 각 job은 여러 step에 따라 단계를 나눌 수 있습니다.
jobs:
build:
name: CD
# 해당 jobs에서 아래의 steps들이 어떠한 환경에서 실행될 것인지를 지정합니다.
runs-on: ubuntu-latest

steps:
# 작업에서 액세스할 수 있도록 $GITHUB_WORKSPACE에서 저장소를 체크아웃합니다.
- uses: actions/checkout@v2
- name: Set up JDK 21
uses: actions/setup-java@v2
with:
java-version: '21'
distribution: 'zulu'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash

- name: Build with Gradle
run: ./gradlew build
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 }}

# script files 복사
- name: Copy script
run: cp ./scripts/*.sh ./deploy

# S3에 업로드
- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip

0 comments on commit 5a1a502

Please sign in to comment.