From 53aaa4eff83bb4771b3bb61d677a1e3cfb5923e9 Mon Sep 17 00:00:00 2001 From: tlsaudwl Date: Wed, 3 Jul 2024 09:39:34 +0900 Subject: [PATCH] =?UTF-8?q?deploy.yml=20=EA=B6=8C=ED=95=9C=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/deploy.yml | 50 +++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 19e14c4..98d5c1f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,35 +10,37 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' - - name: Build with Gradle - run: ./gradlew build + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew - - name: Log in to Docker Hub - run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin + - name: Build with Gradle + run: ./gradlew build - - name: Build Docker image - run: docker build -t ${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest . + - name: Log in to Docker Hub + run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin - - name: Push Docker image - run: docker push ${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest + - name: Build Docker image + run: docker build -t ${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest . - - name: Set up kubectl - run: | - mkdir -p $HOME/.kube - echo "${{ secrets.KUBECONFIG_DATA }}" | base64 --decode > $HOME/.kube/config + - name: Push Docker image + run: docker push ${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest - - name: Delete old pods - run: kubectl delete pods -l app=hanalink-spring-boot-app + - name: Set up kubectl + run: | + mkdir -p $HOME/.kube + echo "${{ secrets.KUBECONFIG_DATA }}" | base64 --decode > $HOME/.kube/config - - name: Deploy to Kubernetes - run: | - kubectl set image deployment/hanalink-spring-boot-app hanalink-spring-boot-app=${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest + - name: Delete old pods + run: kubectl delete pods -l app=hanalink-spring-boot-app + + - name: Deploy to Kubernetes + run: kubectl set image deployment/hanalink-spring-boot-app hanalink-spring-boot-app=${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest