-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (55 loc) · 2.23 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Backend CI/CD
on:
push:
branches:
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Create application.yml
run: |
echo "${{ secrets.APPLICATION_YML }}" > src/main/resources/application.yml
- name: Create Firebase config JSON
run: |
echo "${{ secrets.FIREBASE_CONFIG_JSON }}" > src/main/resources/hanalink-d8253-firebase-adminsdk-t3eoz-05eb36f896.json
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build -x test
- name: Log in to Docker Hub
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest .
- name: Push Docker image
run: docker push ${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest
- name: Configure AWS credentials
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Set up kubectl
run: |
mkdir -p $HOME/.kube
echo "${{ secrets.KUBECONFIG }}" | base64 --decode > $HOME/.kube/config
- name: Delete old pods
run: kubectl delete pods -l app=new-hanalink-spring-boot-app
- name: Deploy to Kubernetes
run: |
kubectl set image deployment/new-hanalink-spring-boot-app new-hanalink-spring-boot-app=${{ secrets.DOCKER_USERNAME }}/hanalink-spring-boot:latest
# - name: action-slack
# uses: 8398a7/action-slack@v3
# with:
# status: ${{ job.status }}
# author_name: www-be
# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
# if_mention: failure,cancelled
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
# if: always()