From 4f423b5c1f4740de22ed95540b7e222faa7087f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=90=ED=99=8D=EC=84=9D?= <78216059+bayy1216@users.noreply.github.com> Date: Tue, 28 May 2024 23:50:17 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]:=20ci=20=EC=95=A1=EC=85=98=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/cicd.yml diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..c87045e --- /dev/null +++ b/.github/workflows/cicd.yml @@ -0,0 +1,33 @@ +name: Build & Deploy + +on: + push: + branches: [ "main" ] # main 브랜치에 push가 발생하면 workflow가 실행됩니다. +permissions: + contents: read # 권한을 설정합니다. + +jobs: + ci: + runs-on: ubuntu-latest + + # set up java + steps: + - name: Checkout Repository # 저장소를 체크아웃합니다. + uses: actions/checkout@v4 + + - name: Set up JDK 17 # JDK 17을 설정합니다. + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'corretto' + + - name: Setup Gradle # Gradle을 설정합니다. + run: | + chmod +x ./gradlew + ./gradlew clean build + + - name: Build docker image and push to docker hub # Docker 이미지를 빌드하고 Docker Hub에 푸시합니다. + run: | + docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} + docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }} . + docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}