Skip to content

Commit

Permalink
♻️refactor: deploy.yml 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
xxoznge committed Jun 6, 2024
1 parent 9bceda1 commit fd1cf3c
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
name: ddabong

on:
# pull_request:
# types: [ closed ]
push:
branches:
- develop
workflow_dispatch: # (2).수동 실행도 가능하도록
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest # (3).OS환경
# if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2 # (4).코드 check out
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17 # (5).자바 설치
java-version: 17
distribution: 'adopt'

- name: Convert to dev YML
Expand All @@ -29,7 +26,7 @@ jobs:
[ -e "application.yml" ] && rm application.yml
echo "spring:" > application.yml
echo " profiles:" >> application.yml
echo " active: dev" >> application.yml
echo " active: dev"
- name: Set dev.yml
uses: microsoft/variable-substitution@v1
Expand All @@ -43,11 +40,11 @@ jobs:

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash # (6).권한 부여
shell: bash

- name: Build with Gradle
run: ./gradlew clean build -x test
shell: bash # (7).build시작
shell: bash

- name: Get current time
uses: 1466587594/get-current-time@v2
Expand All @@ -69,6 +66,14 @@ jobs:
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .
- name: Upload to S3
run: |
aws s3 cp deploy/deploy.zip s3://${{ secrets.S3_BUCKET }}/${{ secrets.S3_FOLDER }}deploy-${{ steps.current-time.outputs.formattedTime }}.zip
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}

- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v20
with:
Expand All @@ -78,5 +83,6 @@ jobs:
environment_name: Project-prod-ddabong-env
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
region: ap-northeast-2
deployment_package: deploy/deploy.zip
s3_bucket: your-s3-bucket-name
s3_key: deployments/deploy-${{ steps.current-time.outputs.formattedTime }}.zip
wait_for_deployment: false

0 comments on commit fd1cf3c

Please sign in to comment.