infra : CI/CD 파이프라인 수정 #52
Workflow file for this run
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
name: Orbit dev CI/CD | |
on: | |
pull_request: | |
branches: | |
- dev | |
types: | |
- closed | |
workflow_dispatch: # (2).수동 실행도 가능하도록 # | |
env: | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest # (3).OS환경 | |
if: github.event.pull_request.merged == true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 # (4).코드 check out | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 21 # (5).자바 설치 | |
distribution: 'adopt' | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
shell: bash # (6).권한 부여 | |
- 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=${{steps.current-time.outputs.formattedTime}}" | |
shell: bash # (9).확보한 시간 보여주기 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Push to Docker Hub | |
run: ./gradlew jib | |
- name: Beanstalk Deploy | |
uses: einaregilsson/beanstalk-deploy@v21 | |
with: | |
aws_access_key: ${{ secrets.AWS_DEV_ACTION_ACCESS_KEY_ID }} | |
aws_secret_key: ${{ secrets.AWS_DEV_ACTION_SECRET_ACCESS_KEY }} | |
application_name: Orbit-dev | |
environment_name: Orbit-dev-env | |
version_label: github-action-${{ steps.current-time.outputs.formattedTime }} | |
region: ap-northeast-2 | |
deployment_package: Dockerrun.aws.json | |
wait_for_environment_recovery: 180 |