chore: build.gradle 수정2 #10
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 workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Java CI with Gradle | |
on: | |
push: | |
branches: [ "develop" ] | |
# pull_request: | |
# branches: [ "develop" ] | |
jobs: | |
build-with-gradle: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: develop 브랜치로 이동 | |
uses: actions/checkout@v4 | |
with: | |
ref: develop | |
- name: JDK 17 설치 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
- name: gradlew에 실행 권한 부여 | |
run: chmod +x ./gradlew | |
- name: 프로젝트 빌드 | |
run: ./gradlew build | |
env: | |
ACCESS_TOKEN_EXP: ${{ secrets.ACCESS_TOKEN_EXP }} | |
REFRESH_TOKEN_EXP: ${{ secrets.REFRESH_TOKEN_EXP }} | |
ODSAY_API_KEY: ${{ secrets.ODSAY_API_KEY }} | |
DATASOURCE_URL: ${{ secrets.DATASOURCE_URL }} | |
DATASOURCE_USERNAME: ${{ secrets.DATASOURCE_USERNAME }} | |
DATASOURCE_PASSWORD: ${{ secrets.DATASOURCE_PASSWORD }} | |
- name: AWS credential 설정 | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-region: ${{ secrets.AWS_REGION }} | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | |
# - name: zip 파일 생성 | |
# run: zip -r project.zip . | |
- name: S3에 업로드 | |
run: aws deploy push --application-name ${{ secrets.AWS_CODE_DEPLOY_APPLICATION }} --ignore-hidden-files --s3-location s3://${{ secrets.AWS_S3_BUCKET }}/makar/$GITHUB_SHA.zip --source . | |
- name: EC2에 업로드 | |
run: aws deploy create-deployment --application-name ${{ secrets.AWS_CODE_DEPLOY_APPLICATION }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ secrets.AWS_CODE_DEPLOY_GROUP }} --s3-location bucket=${{ secrets.AWS_S3_BUCKET }},key=makar/$GITHUB_SHA.zip,bundleType=zip |