forked from databendlabs/databend
-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (188 loc) · 9.46 KB
/
databend-release.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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Release
on:
push:
tags:
- 'v*'
jobs:
publish:
name: Release assets
runs-on: ${{ matrix.config.os }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.REPO_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.REPO_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-2
AWS_DEFAULT_OUTPUT: json
strategy:
fail-fast: false
matrix:
config:
# Linux
- {os: ubuntu-latest, toolchain: stable, target: x86_64-unknown-linux-gnu, cross: false}
- {os: ubuntu-latest, toolchain: stable, target: aarch64-unknown-linux-gnu, cross: true}
- {os: ubuntu-latest, toolchain: stable, target: aarch64-unknown-linux-musl, cross: true}
- {os: ubuntu-latest, toolchain: stable, target: x86_64-unknown-linux-musl, cross: true}
# Macos
- {os: macos-11, toolchain: stable, target: x86_64-apple-darwin, cross: false}
- {os: macos-11, toolchain: stable, target: aarch64-apple-darwin, cross: false}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Rust setup
run: |
bash ./scripts/setup/dev_setup.sh
cargo install --version 0.2.1 cross
- name: Build Binary
run: |
if [ ${{ matrix.config.os }} = "macos-11" ]; then
rustup target add aarch64-apple-darwin
fi
if [ ${{ matrix.config.cross }} = true ]; then
RUSTFLAGS="-C link-arg=-Wl,--compress-debug-sections=zlib-gabi" cross build --release --target=${{ matrix.config.target }}
else
cargo build --release --target=${{ matrix.config.target }}
if [ ${{ matrix.config.os }} = "ubuntu-latest" ]; then
objcopy --compress-debug-sections=zlib-gnu ./target/${{ matrix.config.target }}/release/databend-query
objcopy --compress-debug-sections=zlib-gnu ./target/${{ matrix.config.target }}/release/databend-meta
objcopy --compress-debug-sections=zlib-gnu ./target/${{ matrix.config.target }}/release/databend-metactl
fi
fi
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Pack binaries
run: |
if [ ${{ matrix.config.os }} = "macos-11" ]; then
brew install gnu-tar
sudo /usr/sbin/purge
gtar -C ./target/${{ matrix.config.target }}/release -czvf databend-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.tar.gz databend-query databend-meta
gtar -C ./target/${{ matrix.config.target }}/release -czvf databend-tools-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.tar.gz databend-metactl
else
tar -C ./target/${{ matrix.config.target }}/release -czvf databend-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.tar.gz databend-query databend-meta
tar -C ./target/${{ matrix.config.target }}/release -czvf databend-tools-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.tar.gz databend-metactl
fi
- name: Release databend
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: databend-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.*
asset_name: databend-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}
tag: ${{ github.ref }}
file_glob: true
overwrite: true
body: ${{ steps.changelog_reader.outputs.log_entry }}
- name: Release databend-tools
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: databend-tools-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.*
asset_name: databend-tools-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}
tag: ${{ github.ref }}
file_glob: true
overwrite: true
body: ${{ steps.changelog_reader.outputs.log_entry }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.REPO_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.REPO_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Sync release to S3
run: |
aws s3 cp databend-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.tar.gz s3://repo.databend.rs/databend/${{ steps.get_version.outputs.VERSION }}/databend-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.tar.gz
aws s3 cp databend-tools-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.tar.gz s3://repo.databend.rs/databend/${{ steps.get_version.outputs.VERSION }}/databend-tools-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.target }}.tar.gz
curl https://api.github.com/repos/datafuselabs/databend/tags > tags.json
cat tags.json
aws s3 cp ./tags.json s3://repo.databend.rs/databend/tags.json
release-docker:
name: Release assets
runs-on: ${{ matrix.config.os }}
needs: [publish]
strategy:
fail-fast: false
matrix:
config:
# Linux
- { os: ubuntu-latest, toolchain: stable, target: x86_64-unknown-linux-gnu, cross: false }
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Download binaries for usage
id: download_binaries
run: |
wget https://repo.databend.rs/databend/${{ steps.get_version.outputs.VERSION }}/databend-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-gnu.tar.gz
wget https://repo.databend.rs/databend/${{ steps.get_version.outputs.VERSION }}/databend-${{ steps.get_version.outputs.VERSION }}-aarch64-unknown-linux-gnu.tar.gz
mkdir -p ./target/release
mkdir -p ./target/x86_64-unknown-linux-gnu/release
mkdir -p ./target/aarch64-unknown-linux-gnu/release
tar xC ./target/release -f ./databend-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-gnu.tar.gz
tar xC ./target/x86_64-unknown-linux-gnu/release -f ./databend-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-gnu.tar.gz
tar xC ./target/aarch64-unknown-linux-gnu/release -f ./databend-${{ steps.get_version.outputs.VERSION }}-aarch64-unknown-linux-gnu.tar.gz
mkdir -p ./distro/linux/amd64
mkdir -p ./distro/linux/arm64
cp ./target/x86_64-unknown-linux-gnu/release/databend-meta ./distro/linux/amd64
cp ./target/x86_64-unknown-linux-gnu/release/databend-query ./distro/linux/amd64
cp ./target/aarch64-unknown-linux-gnu/release/databend-meta ./distro/linux/arm64
cp ./target/aarch64-unknown-linux-gnu/release/databend-query ./distro/linux/arm64
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_NAMESPACE }}/databend:${{ steps.get_version.outputs.VERSION }}
platforms: linux/amd64
context: .
file: ./docker/Dockerfile
build-args: VERSION=${{ steps.get_version.outputs.VERSION }}
- name: push meta service
id: push_meta_service
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_NAMESPACE }}/databend-meta:${{ steps.get_version.outputs.VERSION }}
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/meta/Dockerfile
build-args: VERSION=${{ steps.get_version.outputs.VERSION }}
- name: push query service
id: push_query_service
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_NAMESPACE }}/databend-query:${{ steps.get_version.outputs.VERSION }}
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/query/Dockerfile
build-args: VERSION=${{ steps.get_version.outputs.VERSION }}
- name: push distroless meta service
id: push_distroless_meta_service
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_NAMESPACE }}/databend-meta:${{ steps.get_version.outputs.VERSION }}-distroless
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/distroless/meta.Dockerfile
build-args: VERSION=${{ steps.get_version.outputs.VERSION }}
- name: push distroless query service
id: push_distroless_query_service
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKERHUB_NAMESPACE }}/databend-query:${{ steps.get_version.outputs.VERSION }}-distroless
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/distroless/query.Dockerfile
build-args: VERSION=${{ steps.get_version.outputs.VERSION }}