Create README.md #118
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 package using Gradle and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle | |
name: cider-dev | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ develop ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
- name: Set Yaml | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: ./cider-api/src/main/resources/application.yml | |
env: | |
spring.datasource.username: ${{ secrets.DB_USERNAME }} | |
spring.datasource.password: ${{ secrets.DB_PASSWORD }} | |
kakao.restapiKey: ${{secrets.RESTAPI_KEY}} | |
kakao.redirectUrl: ${{secrets.REDIRECT_URL}} | |
cloud.aws.credentials.access-key: ${{secrets.S3_ACCESS_KEY}} | |
cloud.aws.credentials.secret-key: ${{secrets.S3_SECRET_KEY}} | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew # gradle wrapper를 실행할 수 있도록 권한 부여 | |
shell: bash | |
- name: Build API with Gradle | |
run: ./gradlew :cider-api:build # 프로젝트 빌드 | |
shell: bash | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 # 빌드 완료 시간 가져오기 | |
id: current-time | |
with: | |
format: YYYY-MM-DD-HH-mm-ss | |
utcOffset: "+09:00" | |
- name: Show Current Time | |
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}" # 빌드 완료 시간 출력하기 | |
shell: bash | |
# gradle build를 통해 만들어진 jar 파일 beanstalk에 배포하기 위한 zip 파일로 만듦 | |
- name: Generate deployment package | |
run: | | |
mkdir -p deploy | |
cp cider-api/build/libs/*.jar deploy/cider-api.jar | |
cp Procfile deploy/Procfile | |
cp -r .ebextensions-dev deploy/.ebextensions | |
cp -r .platform deploy/.platform | |
cd deploy && zip -r deploy.zip . | |
# Beanstalk Deploy 플러그인 사용 | |
- name: Deploy to EB | |
uses: einaregilsson/beanstalk-deploy@v19 | |
with: | |
aws_access_key: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }} # github secrets로 등록한 값 사용 | |
aws_secret_key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }} # github secrets로 등록한 값 사용 | |
application_name: cider # EB application 이름 | |
environment_name: Cider-env # EB environment 이름 | |
version_label: github-action-${{steps.current-time.outputs.formattedTime}} | |
region: ap-northeast-2 | |
deployment_package: deploy/deploy.zip | |
wait_for_deployment: false | |