dev Winey API Server CI/CD #148
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: dev Winey API Server CI/CD | |
on: | |
push: | |
branches: [develop] | |
workflow_dispatch: # ์๋ ์คํ ์ต์ (์๋ต) | |
jobs: | |
build: | |
runs-on: ubuntu-latest # action ์คํฌ๋ฆฝํธ๊ฐ ์๋๋ OS | |
steps: # ์์ ๋จ๊ณ | |
- name: Checkout source code # ๋จ๊ณ๋ณ ์ด๋ฆ, ๊ตฌ๋ถ์๋ก ์์ค๋ฅผ ๊ฐ์ ธ์ด | |
uses: actions/checkout@v2 | |
- name: Setup JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Set Environment - Common Yml | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: ./Winey-Common/src/main/resources/application-common.yml | |
env: | |
oauth.kakao.base-url: ${{ secrets.KAKAO_BASE_URL }} | |
oauth.kakao.client-id: ${{ secrets.KAKAO_CLIENT }} | |
oauth.kakao.client-secret: ${{ secrets.KAKAO_SECRET }} | |
oauth.kakao.redirect-url: ${{ secrets.KAKAO_REDIRECT }} | |
oauth.kakao.app-id: ${{ secrets.KAKAO_APP_ID }} | |
oauth.kakao.admin-key: ${{ secrets.KAKAO_ADMIN_KEY }} | |
jwt.secret: ${{ secrets.JWT_SECRET_KEY }} | |
jwt.refresh: ${{ secrets.JWT_REFRESH_KEY }} | |
cool-sms.api-key: ${{ secrets.COOL_SMS_API_KEY }} | |
cool-sms.api-secret: ${{ secrets.COOL_SMS_API_SECRET }} | |
cool-sms.from-number: ${{ secrets.COOL_SMS_FROM_NUMBER }} | |
cool-sms.domain: ${{ secrets.COOL_SMS_DOMAIN }} | |
aws.s3.bucket: ${{ secrets.AWS_BUCKET }} | |
aws.s3.base-url: ${{ secrets.AWS_BASE_URL }} | |
aws.s3.access-key: ${{ secrets.AWS_S3_ACCESS_KEY }} | |
aws.s3.secret-key: ${{ secrets.AWS_S3_SECRET_KEY }} | |
spring.redis.host: ${{ secrets.REDIS_HOST }} | |
spring.redis.port: ${{ secrets.REDIS_DEV_PORT }} | |
oauth.apple.iss: ${{ secrets.APPLE_ISS }} | |
oauth.apple.client-id: ${{ secrets.APPLE_CLIENT_ID }} | |
slack.webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
slack.token: ${{ secrets.SLACK_TOKEN }} | |
- name: Set Environment - Domain DEV Yml | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: ./Winey-Domain/src/main/resources/application-domain-dev.yml | |
env: | |
spring.datasource.url: ${{ secrets.DEV_DB_URL_HOST }} | |
spring.datasource.username: ${{ secrets.AWS_DB_USER_NAME }} | |
spring.datasource.password: ${{ secrets.AWS_DB_PASSWORD }} | |
- name: create-fcm-json | |
id: create-fcm-json | |
uses: jsdaniell/[email protected] | |
with: | |
name: "serviceAccountAccessKey.json" | |
json: ${{ secrets.FCM_JSON }} | |
dir: "Winey-Common/src/main/resources/" | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash | |
- name: Build with Gradle | |
run: ./gradlew Winey-Api:bootJar | |
shell: bash | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYYMMDDTHHmm | |
utcOffset: "+09:00" | |
- name: Generate deployment packagez | |
run: | | |
mkdir -p deploy | |
cp Winey-API/build/libs/*.jar deploy/winey-dev-api.jar | |
cp Procfile deploy/Procfile | |
cp -r .ebextensions-dev deploy/.ebextensions | |
cp -r .platform deploy/.platform | |
cd deploy && zip -r winey-server-api-${{steps.current-time.outputs.formattedTime}}-${{github.sha}} . | |
- name: Deploy Consumer to EB | |
uses: einaregilsson/beanstalk-deploy@v19 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: Winey-Api-Dev | |
environment_name: Winey-Api-Dev-env | |
version_label: winey-server-api-${{steps.current-time.outputs.formattedTime}}-${{github.sha}} | |
region: ap-northeast-2 | |
deployment_package: deploy/winey-server-api-${{steps.current-time.outputs.formattedTime}}-${{github.sha}}.zip | |
wait_for_deployment: false |