@@ -10,51 +10,70 @@ jobs:
10
10
runs-on : ubuntu-latest
11
11
12
12
steps :
13
+ # 1. Checkout code
13
14
- name : Checkout code
14
15
uses : actions/checkout@v3 # 최신 버전 사용
15
16
17
+ # 2. Cache Gradle dependencies
18
+ - name : Cache Gradle dependencies
19
+ uses : actions/cache@v4
20
+ with :
21
+ path : ~/.gradle/caches
22
+ key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradlew') }}
23
+ restore-keys : |
24
+ ${{ runner.os }}-gradle-
25
+
26
+ # 3. Set up Docker Buildx
16
27
- name : Set up Docker Buildx
17
28
uses : docker/setup-buildx-action@v2 # 최신 버전 사용
18
29
30
+ # 4. Cache Docker layers
19
31
- name : Cache Docker layers
20
- uses : actions/cache@v3 # 최신 버전 사용
32
+ uses : actions/cache@v3
21
33
with :
22
34
path : /tmp/.buildx-cache
23
35
key : ${{ runner.os }}-buildx-${{ github.sha }}
24
36
restore-keys : |
25
37
${{ runner.os }}-buildx-
26
38
39
+ # 5. Log in to Google Cloud
27
40
- name : Log in to Google Cloud
28
- uses : google-github-actions/auth@v1 # 최신 버전 사용
41
+ uses : google-github-actions/auth@v1
29
42
with :
30
43
credentials_json : ${{ secrets.GCP_CREDENTIALS }}
31
44
45
+ # 6. Configure docker for gcloud
32
46
- name : Configure docker for gcloud
33
47
run : gcloud auth configure-docker asia-northeast3-docker.pkg.dev
34
48
49
+ # 7. Build and push Docker image
35
50
- name : Build and push Docker image
36
51
run : |
37
52
docker buildx build --push \
38
53
--cache-from=type=local,src=/tmp/.buildx-cache \
39
54
--cache-to=type=local,dest=/tmp/.buildx-cache \
55
+ --build-arg GRADLE_USER_HOME=/home/gradle/.gradle \
40
56
--tag asia-northeast3-docker.pkg.dev/symbolic-yen-441710-h6/practice-main/kafka-user:${{ github.sha }} .
41
57
42
58
deploy :
43
59
runs-on : ubuntu-latest
44
60
needs : build
45
61
46
62
steps :
63
+ # 1. Checkout deployment repo
47
64
- name : Checkout deployment repo
48
- uses : actions/checkout@v3 # 최신 버전 사용
65
+ uses : actions/checkout@v3
49
66
with :
50
67
repository : kafka-practice/kafka-manifest
51
68
path : manifests
52
69
token : ${{ secrets.DEPLOY_KEY }}
53
70
71
+ # 2. Update manifest
54
72
- name : Update manifest
55
73
run : |
56
74
sed -i "s|image: .*|image: asia-northeast3-docker.pkg.dev/symbolic-yen-441710-h6/practice-main/kafka-user:${{ github.sha }}|" manifests/kafka-user/deployment.yaml
57
-
75
+
76
+ # 3. Commit and push changes
58
77
- name : Commit and push changes
59
78
working-directory : manifests
60
79
run : |
0 commit comments