Skip to content

Update AzureConfig.java #76

Update AzureConfig.java

Update AzureConfig.java #76

Workflow file for this run

# github repository Actions 페이지에 나타낼 이름
name: CI/CD
# event trigger
on:
push:
branches:
- develop
permissions:
contents: read
jobs:
CI:
runs-on: ubuntu-latest
## jdk setting
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '21'
## gradle caching
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
## create application-dev.yml
- name: make application.yml
if: contains(github.ref, 'develop')
run: |
mkdir -p ./src/main/resources
cd ./src/main/resources
touch ./application.yml
touch ./application-prod.yml
echo "${{ secrets.PROPERTIES }}" > ./application.yml
shell: bash
- name: make model foundation
run: |
cd ./src/main/resources
touch ./instruction.txt
echo "${{ secrets.ENV_INSTRUCTION }}" > ./instruction.txt
shell: bash
env:
LC_ALL : C.UTF-8
- name: make menu data
run: |
cd ./src/main/resources
touch ./menu_final.txt
echo "${{ secrets.ENV_MENUFINAL }}" > ./menu_final.txt
shell: bash
env:
LC_ALL : C.UTF-8
- name: Verify file creation
run: ls -la $GITHUB_WORKSPACE/src/main/resources/
# gradle build 위한 permission
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
# Spring Boot 애플리케이션 빌드
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: clean bootJar
# DockerHub 로그인
- name: docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# Docker 이미지 빌드
# docker file 생성 필요
- name: docker image build
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/mju_capstone
CD:
needs: CI
runs-on: ubuntu-latest
## deploy to develop
steps:
- name: Deploy to dev
uses: appleboy/ssh-action@v1.0.3
id: deploy-dev
if: contains(github.ref, 'develop')
with:
key: ${{ secrets.PRIVATE_KEY }}
host: ${{ secrets.HOST_DEV }}
username: ${{ secrets.USER_NAME }}
port: ${{ secrets.PORT }}
script: |
whoami
sudo docker rm -f $(sudo docker ps -qa)
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}
sudo docker run -dp 80:8080 ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}
## time ##
current-time:
needs: CD
runs-on: ubuntu-latest
steps:
- name: Get Current Time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH:mm:ss
utcOffset: "+09:00" # 기준이 UTC이기 때문에 한국시간인 KST를 맞추기 위해 +9시간 추가
- name: Print Current Time
run: echo "Current Time=${{steps.current-time.outputs.formattedTime}}" # current-time 에서 지정한 포맷대로 현재 시간 출력
shell: bash