Skip to content

Commit 9c4fbc7

Browse files
committed
dev: gke continuous deploy workflow
1 parent 55c3da6 commit 9c4fbc7

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

.github/workflows/deploy.yaml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
on:
2+
push:
3+
branches:
4+
- "feature/gke-deploy"
5+
6+
jobs:
7+
docker:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Set up Corretto openJDK 17
14+
uses: actions/setup-java@v3 # check specific version in https://github.com/actions/setup-java
15+
with:
16+
distribution: 'corretto'
17+
java-version: '17'
18+
19+
- name: Gradle caching
20+
uses: actions/cache@v3
21+
with:
22+
path: |
23+
~/.gradle/caches
24+
~/.gradle/wrapper
25+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
26+
restore-keys: |
27+
${{ runner.os }}-gradle-
28+
29+
- name: Grant execute permission for gradlew
30+
run: chmod +x ./gradlew
31+
32+
- name: Build and test project
33+
run: ./gradlew build
34+
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Login to Docker Hub
42+
uses: docker/login-action@v3
43+
with:
44+
username: ${{ secrets.DOCKERHUB_USERNAME }}
45+
password: ${{ secrets.DOCKERHUB_TOKEN }}
46+
47+
- name: Build agent and push
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: /bm-agent
51+
platforms: linux/amd64,linux/arm64
52+
push: true
53+
tags: ghkdqhrbals/bm-agent:latest
54+
55+
- name: Build controller and push
56+
uses: docker/build-push-action@v5
57+
with:
58+
context: /bm-controller
59+
platforms: linux/amd64,linux/arm64
60+
push: true
61+
tags: ghkdqhrbals/bm-controller:latest
62+
63+
- name: Configure google cloud credentials
64+
id: auth
65+
uses: google-github-actions/auth@v2
66+
with:
67+
credentials_json: ${{ secrets.GCP_SA_KEY }}
68+
69+
- name: Set up gcloud cli
70+
uses: google-github-actions/setup-gcloud@v2
71+
72+
- name: Set GKE cluster context
73+
uses: google-github-actions/get-gke-credentials@v2
74+
with:
75+
cluster_name: ${{ secrets.GKE_CLUSTER }}
76+
location: ${{ secrets.GKE_ZONE }}
77+
78+
- name: Deploy to GKE
79+
run: |
80+
kubectl apply -f ./kubernetes/volume
81+
kubectl apply -f ./kubernetes/ingress
82+
kubectl apply -f ./kubernetes/service
83+
kubectl apply -f ./kubernetes/deploy

0 commit comments

Comments
 (0)