-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: ddingdong-dev-depoly | ||
|
||
on: | ||
push: | ||
branches: | ||
#TODO: develop 브랜치로 변경 | ||
- feature/DEV-7-deploy-test-server | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
|
||
- name: Set yaml file | ||
uses: microsoft/variable-substitution@v1 | ||
with: | ||
files: ./src/main/resources/application.yml | ||
env: | ||
spring.datasource.url: ${{secrets.DB_URL}} | ||
spring.datasource.username: ${{secrets.DB_USERNAME}} | ||
spring.datasource.password: ${{secrets.DB_PASSWORD}} | ||
spring.s3.bucket: ${{secrets.BUCKET_NAME}} | ||
sprig.s3.access-key: ${{secrets.AWS_ACCESS_KEY_ID}} | ||
sprig.s3.secret-key: ${{secrets.AWS_SECRET_ACCESS_KEY}} | ||
cloud.aws.region.static: ${{secrets.AWS_DEFAULT_REGION}} | ||
jwt.secret: ${{secrets.JWT_SECRET}} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
shell: bash | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew clean build | ||
shell: bash | ||
|
||
- name: Get current time | ||
uses: 1466587594/get-current-time@v2 | ||
id: current-time | ||
with: | ||
format: YYYY-MM-DDTHH-mm-ss | ||
utcOffset: "+09:00" # 한국 시간에 맞추기 위함 | ||
|
||
# grandle build를 통해 만들어진 jar를 beanstalk에 배포하기 위한 zip 파일로 만드는 것 | ||
- name: Generate deployment package | ||
run: | | ||
mkdir -p deploy | ||
cp build/libs/*.jar deploy/application.jar | ||
cp Procfile deploy/Procfile | ||
cp -r .ebextensions deploy/.ebextensions | ||
cp -r .platform deploy/.platform | ||
cd deploy && zip -r deploy.zip . | ||
# Beanstalk Deploy 플러그인 사용 | ||
- name: Beanstalk Deploy | ||
uses: einaregilsson/beanstalk-deploy@v21 | ||
with: | ||
aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} # github secrets로 등록한 값 사용 | ||
aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} # github secrets로 등록한 값 사용 | ||
application_name: ddingdong-staging # EB application 이름 | ||
environment_name: ddingdong-staging-env # EB environment 이름 | ||
version_label: Github Action-${{steps.current-time.outputs.formattedTime}} # 배포 버전은 타임스탬프를 이용하여 구분 | ||
region: ap-northeast-2 | ||
deployment_package: deploy/deploy.zip | ||
wait_for_environment_recovery: 180 |