-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (64 loc) · 2.27 KB
/
transfer-service-cd.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
72
73
74
75
name: cd for transfer-service
on:
pull_request:
branches: [ main ]
paths:
- transfer-service/**
- .github/workflows/transfer-service-cd.yml
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
REGION: ${{ secrets.REGION }}
WORKSTATION_IMAGE: transfer-service
VERSION: '1.1.0'
IMAGE: ${{ secrets.REGION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.DOCKER_REPO }}/transfer-service
REDIS_HOST: ${{secrets.REDIS_HOST}}
REDIS_PORT: ${{secrets.REDIS_PORT}}
DATASOURCE_URL: ${{secrets.DB_URL}}
DATASOURCE_USERNAME: ${{secrets.DB_USERNAME}}
DATASOURCE_PASSWORD: ${{secrets.DB_PASSWORD}}
SLACK_WEBHOOK_URL: ${{secrets.SLACK_WEBHOOK_URL}}
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Check out Repository
uses: actions/checkout@v3
- name: Cache Gradle caches
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ github.job}}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-${{ github.job }}
- name: Cache Jib layers
uses: actions/cache@v3
with:
path: ./transfer-service/build/jib-cache
key: ${{ runner.os }}-jib-${{ github.job }}-${{ hashFiles('**/build.gradle') }}
restore-keys: ${{ runner.os }}-jib-${{ github.job }}
- name: Set up google auth
id: 'auth'
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCE_SA_KEY }}
- id: 'get-credentials'
uses: google-github-actions/get-gke-credentials@v1
with:
cluster_name: cluster-1
location: ${{ env.REGION }}
- name: Docker auth
run: |-
gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Docker Build
run: ./gradlew :transfer-service:jib
- name: Deploy
run: |
sed "s,\${image},${{ env.IMAGE }},g" ./transfer-service/resources.yaml > cronJob.yaml
kubectl apply -f ./cronJob.yaml