[REFACTOR] parameter 디폴트 값 삭제 #119
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: Java CI with Gradle & Deploy to EC2 | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "master" branch | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- closed | |
branches: | |
- master | |
env: | |
AWS_REGION: ap-northeast-2 | |
permissions: | |
contents: read | |
jobs: | |
deploy: | |
name : Deploy | |
runs-on: ubuntu-latest | |
environment : production | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
# 1) 기본 체크아웃 | |
- name: Checkout | |
uses: actions/checkout@v1 | |
# JDK setting - github actions에서 사용할 JDK 설정 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# gradle caching - 빌드 시간 향상 | |
- name: Gradle Caching | |
uses: actions/cache@v1 | |
with: | |
path: | | |
~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Set up Environment Properties | |
run: | | |
mkdir -p ./Api/src/main/resources/ | |
mkdir -p ./Core/src/main/resources/ | |
mkdir -p ./Domain/src/main/resources/ | |
mkdir -p ./Infrastructure/src/main/resources/ | |
touch ./Api/src/main/resources/application.properties | |
touch ./Core/src/main/resources/application-core.properties | |
touch ./Domain/src/main/resources/application-domain.properties | |
touch ./Infrastructure/src/main/resources/application-infrastructure.properties | |
echo "${{ secrets.APPLICATION }}" > ./Api/src/main/resources/application.properties | |
echo "${{ secrets.APPLICATION_CORE }}" > ./Core/src/main/resources/application-core.properties | |
echo "${{ secrets.APPLICATION_DOMAIN }}" > ./Domain/src/main/resources/application-domain.properties | |
echo "${{ secrets.APPLICATION_INFRASTRUCTURE }}" > ./Infrastructure/src/main/resources/application-infrastructure.properties | |
# 3) gradlew 권한 설정 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
working-directory: ${{ env.working-directory }} | |
- name: Build with Gradle | |
run: ./gradlew build | |
working-directory: ${{ env.working-directory }} | |
# AWS 사용자 정보 입력 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.ACCESS_KEY_SECRET }} | |
aws-region: ap-northeast-2 | |
# AWS S3에 업로드 | |
- name: Upload to AWS S3 | |
run: | | |
aws deploy push \ | |
--application-name ${{ secrets.CODE_DEPLOY_APP_NAME }} \ | |
--ignore-hidden-files \ | |
--s3-location s3://${{ secrets.S3_BUCKET_NAME }}/$GITHUB_SHA.zip \ | |
--source . | |
# CodeDeploy에 배포 요청 | |
- name: Code Deploy | |
run: | | |
aws deploy create-deployment \ | |
--application-name ${{ secrets.CODE_DEPLOY_APP_NAME }} \ | |
--deployment-config-name CodeDeployDefault.AllAtOnce \ | |
--deployment-group-name ${{ secrets.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \ | |
--s3-location bucket=${{ secrets.S3_BUCKET_NAME }},key=$GITHUB_SHA.zip,bundleType=zip |