diff --git a/.github/ISSUE_TEMPLATE/-----.md b/.github/ISSUE_TEMPLATE/-----.md new file mode 100644 index 00000000..cc134e61 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/-----.md @@ -0,0 +1,24 @@ +--- +name: 개발 관련 +about: 새로운 기능을 개발할 때 사용해주세요! +title: "[FEAT][Domain]" +labels: features +assignees: '' + +--- + + +## 기능에 대한 설명 + +- 기능에 대한 필요성을 작성 +1. 기능1 +2. 기능2 +3. ... + +## 기능 구현 마감일 +- 2022년 8월 30일까지 개발을 마칩니다. diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..78e73115 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,77 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: CI/CD + +on: + push: + branches: [ "prod" ] + +permissions: + contents: read + +jobs: + CI-CD: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + + ## 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- + + ## docker build & push to production + - name: Docker build & push to prod + run: | + docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + docker build -f Dockerfile-prod -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} . + docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} + + ## deploy to production + - name: Deploy to prod + uses: appleboy/ssh-action@master + id: deploy-prod + with: + host: ${{ secrets.EC2_HOST }} + username: ec2-user + key: ${{ secrets.EC2_PRIVATE_KEY }} + envs: GITHUB_SHA + script: | + sudo docker rm -f $(docker ps -qa) + sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO }} + docker-compose up -d + docker image prune -f + +## time + current-time: + needs: CI-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