-
Notifications
You must be signed in to change notification settings - Fork 12
160 lines (140 loc) · 5.33 KB
/
release.yaml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Release
on:
release:
types:
- published
workflow_dispatch:
jobs:
parse-release-version:
name: Parse kdb & kgw version
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
vkdb: ${{ steps.versions.outputs.kdb_version }}
vkgw: ${{ steps.versions.outputs.kgw_version }}
vkjs: ${{ steps.versions.outputs.kjs_version }}
steps:
- name: Get kdb n kgw version # minor version
id: versions
shell: bash
run: |
version=`echo ${{ github.event.release.tag_name }} | sed 's/^v//' | cut -d '.' -f 2`
kgw_version=$(v7="2"; v6="1"; eval echo \${v$version})
kjs_version=$(v7="6"; v6="5"; eval echo \${v$version})
echo "kdb_version=v0.$version" >> $GITHUB_OUTPUT
echo "kgw_version=v0.$kgw_version" >> $GITHUB_OUTPUT
echo "kjs_version=v0.$kjs_version" >> $GITHUB_OUTPUT
echo "kdb_version=v0.$version <> kgw_version=v0.$kgw_version <> kjs_version=v0.$kjs_version"
kgw-test-release:
name: Run kgw test on release branches
needs: parse-release-version
uses: ./.github/workflows/kgw-test-reuse.yaml
with:
kdb-ref: release-${{ needs.parse-release-version.outputs.vkdb }}
kgw-ref: release-${{ needs.parse-release-version.outputs.vkgw }}
# kwil-js has no release branch, we'll use the latest tag of this minor version
kjs-ref: ${{ needs.parse-release-version.outputs.vkjs }}
secrets:
kgw-access-token: ${{ secrets.KGW_MACH_SECRET_FOR_KWILDB }}
build-push-image:
name: Build & push image
if: false # temporary disable
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
token: ${{ secrets.KWIL_MACH_SECRET }}
- name: Install Protoc
uses: arduino/setup-protoc@v2
with:
version: '23.4'
repo-token: ${{ secrets.KWIL_MACH_SECRET }}
- name: Install Taskfile
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.KWIL_MACH_SECRET }}
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
check-latest: true
- name: Install dependencies
env:
GH_ACCESS_TOKEN: ${{ secrets.KWIL_MACH_SECRET }}
run: |
go version
git config --global url."https://${GH_ACCESS_TOKEN}:x-oauth-basic@github.com/kwilteam/".insteadOf "https://github.com/kwilteam/"
task install:deps
go mod download
- name: Generate go vendor
#for faster builds and private repos, need to run this after pb:compile:v1
run: |
task vendor
- name: configure variables
id: config
run: |
version=`echo ${{ github.event.release.tag_name }} | sed 's/^v//'`
echo "version=$version" >> $GITHUB_OUTPUT
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers for KD
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache-kwild
#key: ${{ runner.os }}-buildx-kwild-${{ github.sha }}
key: ${{ runner.os }}-buildx-kwild
restore-keys: |
${{ runner.os }}-buildx-kwild
- name: Build & push KD image
id: docker_build_kwild
uses: docker/build-push-action@v4
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
build-args: |
git_commit=${{ github.sha }}
version=${{ steps.config.outputs.version }}
build_time=${{ github.event.release.created_at }}
file: ./build/package/docker/kwild.dockerfile
push: true
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ secrets.AWS_KWILD_ECR }}:${{ steps.config.outputs.version }}
${{ steps.login-ecr.outputs.registry }}/${{ secrets.AWS_KWILD_ECR }}:latest
cache-from: type=local,src=/tmp/.buildx-cache-kwild
cache-to: type=local,dest=/tmp/.buildx-cache-kwild-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache-kwild
mv /tmp/.buildx-cache-kwild-new /tmp/.buildx-cache-kwild
deploy-to-eks:
name: Deploy to k8s cluster
if: false # temporary disable
runs-on: ubuntu-latest
needs: build-push-image
steps:
- name: configure variables
id: config
run: |
if [[ '${{ github.event.release.prerelease }}' == 'true' ]]; then
echo "cluster=staging" >> $GITHUB_OUTPUT
else
echo "cluster=prod" >> $GITHUB_OUTPUT
fi
version=`echo ${{ github.event.release.tag_name }} | sed 's/^v//'`
echo "version=$version" >> $GITHUB_OUTPUT
- name: deploy by release type to different eks cluster
run: |
echo "will deploy ${{ steps.config.outputs.version }} to eks ${{ steps.config.outputs.cluster }} cluster"