Skip to content

Commit

Permalink
deploy.yml 권한 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
tlsaudwl committed Jul 3, 2024
1 parent 6b49551 commit 53aaa4e
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 53aaa4e

Please sign in to comment.