Skip to content

Feature/2

Feature/2 #34

Workflow file for this run

name: UMC 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 == 'develop'
steps:
- name: Checkout
uses: actions/checkout@v2 # (4).코드 check out -> 위에 적은 develop 브랜치에서 코드 가져오기
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17 # (5).자바 설치
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash # (6).권한 부여 -> 새로 들어 갈 컴퓨터(E2C 등)의 gradlew에 대한 실행 권한
- name: Build with Gradle
run: ./gradlew clean build -x test
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 .
# build/libs/*: 깃험 액션이 빌드한 파일을 컴퓨터에 올리기 전 임시적으로 저장해 두는 디렉토리
# Procfile: 리눅스의 Makefile과 비슷한 것
# .ebextensions-dev: beanstalk에게 추가적인 기능을 요청하기 위한 설정
# .platform: 추가적인 플랫폼 설정(웹 서버인 nginx 등)
# 마지막은 압축!
- 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: team4-develop
environment_name: Team4-develop-env
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
region: ap-northeast-2
deployment_package: deploy/deploy.zip
wait_for_deployment: false