Skip to content

Feat: 배포 테스트 및 CICD 적용 #6

Feat: 배포 테스트 및 CICD 적용

Feat: 배포 테스트 및 CICD 적용 #6

Workflow file for this run

name: tenten
on:
push:
branches: [ "main", "develop" ]
paths-ignore:
- 'README.md' # README.md 파일 변경을 무시
pull_request:
branches: [ "main", "develop" ]
jobs:
build:
runs-on: ubuntu-latest # 우분투 설치
steps:
- name: Checkout
uses: actions/checkout@v3 # 코드 다운로드 / 적기 귀찮은 것들을 라이브러리(스크립트 모임) 형태로 제공하는 것이 actions 이다.
- name: Set up JDK 17
uses: actions/setup-java@v3 # jdk 설치 / 버전마다 다른 jdk 설치 제공
with:
java-version: 17
distribution: oracle
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew # gradlew 실행권한 부여
- name: Build with Gradle
run: ./gradlew clean build # build 하기
# UTC가 기준이기 때문에 한국시간으로 맞추려면 +9시간 해야 한다
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00"
- name: Show Current Time
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}"
# EB에 CD
- name: Generate deployment package # 배포패키지 생성
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions deploy/.ebextensions
cd deploy && zip -r deploy.zip .
- name: Deploy to EB # 배포
uses: einaregilsson/beanstalk-deploy@v21 # 엘라스틱 빈스톡으로 배포하는 라이브러리
with:
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }}
aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
application_name: tenten-beanstalk # 엘라스틱 빈스톡 애플리케이션 이름
environment_name: Tenten-beanstalk-env-2 # 엘라스틱 빈스톡 환경 이름
version_label: tenten-${{steps.current-time.outputs.formattedTime}}
region: ap-northeast-2
deployment_package: deploy/deploy.zip # 배포패키지 경로