[fix]: 오타수정 #45
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: Onnoff Dev CI/CD | |
on: | |
pull_request: | |
types: [closed] | |
workflow_dispatch: # (2).수동 실행도 가능하도록 | |
jobs: | |
build: | |
runs-on: ubuntu-latest # (3).OS환경 | |
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'dev' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 # (4).코드 check out | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 # (5).자바 설치 | |
distribution: 'adopt' | |
- name: Set Yaml | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: ./src/main/resources/application.yml | |
env: | |
spring.jwt.secret: ${{ secrets.JWT_SECRET }} | |
apple.redirect-uri: ${{ secrets.APPLE_REDIRECT_URI }} | |
apple.client-id: ${{ secrets.APPLE_CLIENT_ID }} | |
apple.team-id: ${{ secrets.APPLE_TEAM_ID }} | |
apple.key.id: ${{ secrets.APPLE_KEY_ID }} | |
apple.key.path: /var/app/current/src/main/resources/AuthKey_${{ secrets.APPLE_KEY_ID }}.p8 | |
kakao.redirect-uri: ${{ secrets.KAKAO_REDIRECT_URI }} | |
kakao.client-id: ${{ secrets.KAKAO_CLIENT_ID }} | |
kakao.admin-key: ${{ secrets.KAKAO_ADMIN_KEY }} | |
fcm.firebase-sdk-path: /var/app/current/src/main/resources/${{ secrets.FIREBASE_SDK_PATH }} | |
fcm.project-id: ${{ secrets.FIREBASE_PROJECT_ID }} | |
- name: Set Dev Yaml | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: ./src/main/resources/application-dev.yml | |
env: | |
spring.datasource.url: jdbc:mysql://${{ secrets.DEV_DB_URI }}?serverTimezone=Asia/Seoul&characterEncoding=UTF-8 | |
spring.datasource.username: ${{ secrets.DEV_DB_USERNAME }} | |
spring.datasource.password: ${{ secrets.DEV_DB_PASSWORD }} | |
cloud.aws.s3.bucket: ${{ secrets.DEV_S3_BUCKET }} | |
cloud.aws.credentials.access-key: ${{ secrets.DEV_S3_ACCESS_KEY }} | |
cloud.aws.credentials.secret-key: ${{ secrets.DEV_S3_SECRET_KEY }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash # (6).권한 부여 | |
- name: Build with Gradle | |
run: ./gradlew clean build | |
shell: bash # (7).build 시작 | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYY-MM-DDTHH-mm-ss | |
utcOffset: "+09:00" # (8).build 시점의 시간확보 | |
- name: Show Current Time | |
run: echo "CurrentTime=$" | |
shell: bash # (9).확보한 시간 보여주기 | |
- name: Generate deployment package | |
run: | | |
mkdir -p deploy | |
cp build/libs/*.jar deploy/application.jar | |
cp Procfile deploy/Procfile | |
cp -r .ebextensions_dev deploy/.ebextensions | |
cp -r .platform deploy/.platform | |
cd deploy && zip -r deploy.zip . | |
- name: Beanstalk Deploy | |
uses: einaregilsson/beanstalk-deploy@v20 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} | |
application_name: onnoff-dev # 원하는 어플 이름 | |
environment_name: Onnoff-dev-env # 원하는 환경 이름 | |
version_label: github-action-${{ steps.current-time.outputs.formattedTime }} | |
region: ap-northeast-2 | |
deployment_package: deploy/deploy.zip | |
wait_for_deployment: false |