fix: logging -> slf4j log change #126
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
name: Twincle Project Spring Boot & Gradle CI/CD | |
on: | |
push: | |
branches: [ "dev" ] | |
pull_request: | |
branches: [ "dev" ] | |
env: | |
AWS_REGION: ap-northeast-2 | |
AWS_S3_BUCKET: linkarchive | |
AWS_CODE_DEPLOY_APPLICATION: LinkArchive-CD | |
AWS_CODE_DEPLOY_GROUP: LinkArchive-CD-group | |
jobs: | |
build-ci-only: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: JDK 17 설치 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
cache: gradle | |
- name: gradlew에 실행 권한 부여 | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: 프로젝트 빌드 | |
run: ./gradlew clean build --exclude-task test | |
shell: bash | |
- name: 프로젝트 테스트 실행 | |
run: ./gradlew test | |
shell: bash | |
build-and-deploy: | |
if: github.event_name == 'push' | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: dev 브랜치로 이동 | |
uses: actions/checkout@v3 | |
with: | |
ref: dev | |
- name: JDK 17 설치 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
cache: gradle | |
- name: make application.yml | |
if: contains(github.ref, 'dev') | |
run: | | |
cd ./src/main/resources | |
touch ./application.yml | |
echo "${{ secrets.YML_BASE }}" > ./application.yml | |
touch ./application-dev.yml | |
echo "${{ secrets.YML_DEV }}" > ./application-dev.yml | |
touch ./application-oauth.yml | |
echo "${{ secrets.YML_AUTH }}" > ./application-oauth.yml | |
touch ./application-aws.yml | |
echo "${{ secrets.YML_AWS }}" > ./application-aws.yml | |
touch ./application-jwt.yml | |
echo "${{ secrets.YML_JWT }}" > ./application-jwt.yml | |
shell: bash | |
- name: gradlew에 실행 권한 부여 | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: 프로젝트 빌드 | |
run: ./gradlew clean build --exclude-task test | |
shell: bash | |
- name: 프로젝트 테스트 실행 | |
run: ./gradlew test | |
shell: bash | |
- name: Make zip file | |
run: zip -r ./$GITHUB_SHA.zip . | |
shell: bash | |
- name: AWS credential 설정 | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
aws-access-key-id: ${{ secrets.LINKARCHIVE_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.LINKARCHIVE_SECRET_KEY }} | |
- name: S3에 업로드 | |
run: aws deploy push --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --ignore-hidden-files --s3-location s3://${{ env.AWS_S3_BUCKET }}/cicdtest/$GITHUB_SHA.zip --source . | |
- name: EC2에 배포 | |
run: aws deploy create-deployment --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ env.AWS_CODE_DEPLOY_GROUP }} --s3-location bucket=${{ env.AWS_S3_BUCKET }},key=cicdtest/$GITHUB_SHA.zip,bundleType=zip |