Update README.md #62
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: Deploy-to-AWS-Elastic-Beanstalk | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 11 # JDK 설치 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: make application yml # application.yml 생성 | |
run: | | |
cd ./src/main/resources | |
touch ./application.yml | |
echo "${{ secrets.APPLICATION_YML }}" > ./application.yml | |
shell: bash | |
- name: Grant execute permission for gradlew # gradle 실행 권한 설정 | |
run: chmod +x ./gradlew | |
- name: Build with Gradle # gradle 설치 | |
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0 | |
with: | |
arguments: build | |
- name: Get current time # 배포 버전 설정 | |
uses: 1466587594/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYY-MM-DDTHH-mm-ss | |
utcOffset: "+09:00" | |
- name: Generate deployment package # jar 압축 파일 생성 | |
run: zip -r deploy.zip . -x '*.git*' | |
- name: Deploy to EB # AWS Beanstalk 로 자동 배포 | |
uses: einaregilsson/beanstalk-deploy@v21 | |
with: | |
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
application_name: ecoreading | |
environment_name: Ecoreading-env | |
version_label: github-action-${{steps.current-time.outputs.formattedTime}} | |
region: ap-northeast-2 | |
deployment_package: deploy.zip |