forked from prestodb/presto
-
Notifications
You must be signed in to change notification settings - Fork 1
318 lines (284 loc) · 11.5 KB
/
presto-release-publish.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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
name: Presto Stable - Release Publish
on:
workflow_dispatch:
inputs:
RELEASE_VERSION:
description: 'Release version (e.g., 0.290)'
required: true
publish_maven:
description: 'Publish Maven artifacts'
type: boolean
default: true
required: false
publish_docker:
description: 'Publish Docker images'
type: boolean
default: true
required: false
publish_native_docker:
description: 'Publish Native Docker images'
type: boolean
default: true
required: false
tag_image_as_latest:
description: 'Tag the image as latest version'
type: boolean
default: true
required: false
dependency_image:
description: 'Dependency image(e.g., prestodb/presto-native-dependency:0.290-20241014120930-e1fc090)'
required: false
default: ''
env:
VERSION: ${{ github.event.inputs.RELEASE_VERSION }}
DOCKER_REPO: ${{ github.repository }}
ORG_NAME: ${{ github.repository_owner }}
IMAGE_NAME: presto-native
jobs:
publish-maven-artifacts:
runs-on: ubuntu-latest
environment: release
timeout-minutes: 30
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
steps:
- name: Setup JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
overwrite-settings: true
gpg-private-key: ${{ secrets.GPG_SECRET }}
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential git gpg python3 python3-venv
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
token: ${{ secrets.PRESTODB_CI_TOKEN }}
fetch-depth: 0
fetch-tags: true
- name: Configure Git
run: |
git config --global user.email "ci@lists.prestodb.io"
git config --global user.name "prestodb-ci"
git config pull.rebase false
- name: Set up GPG key
run: |
echo "${{ secrets.GPG_SECRET }}" > ${{ env.GPG_KEY_FILE }}
chmod 600 ${{ env.GPG_KEY_FILE }}
gpg --import --batch ${{ env.GPG_KEY_FILE }}
gpg --batch --yes --pinentry-mode loopback --passphrase "${{ secrets.GPG_PASSPHRASE }}" --sign ${{ env.GPG_KEY_FILE }}
env:
GPG_TTY: $(tty)
GPG_KEY_FILE: /tmp/gpg-key.txt
- name: Create Maven Settings
run: |
cat > ${{ github.workspace }}/settings.xml << 'EOL'
<settings>
<servers>
<server>
<id>sonatype-nexus-snapshots</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
<server>
<id>sonatype.snapshots</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
<server>
<id>ossrh</id>
<username>${env.NEXUS_USERNAME}</username>
<password>${env.NEXUS_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<id>nexus</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
EOL
- name: Maven build
run: mvn clean install -DskipTests
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: presto-artifacts-${{ env.VERSION }}
retention-days: 1
path: |
presto-server/target/presto-server-*.tar.gz
presto-cli/target/presto-cli-*-executable.jar
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: presto-artifacts-${{ env.VERSION }}
retention-days: 1
path: |
presto-server/target/presto-server-*.tar.gz
presto-cli/target/presto-cli-*-executable.jar
- name: Release Maven Artifacts
if: ${{ github.event.inputs.publish_maven == 'true' }}
run: |
unset MAVEN_CONFIG
./mvnw -s ${{ github.workspace }}/settings.xml -V -B -U -e -T1C deploy \
-Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" \
-Dmaven.wagon.http.retryHandler.count=8 \
-DskipTests \
-DstagingProfileId=28a0d8c4350ed \
-DkeepStagingRepositoryOnFailure=true \
-DkeepStagingRepositoryOnCloseRuleFailure=true \
-DautoReleaseAfterClose=true \
-DstagingProgressTimeoutMinutes=60 \
-Poss-release \
-Pdeploy-to-ossrh \
-pl '!presto-test-coverage'
env:
GPG_TTY: $(tty)
publish-docker-images:
if: ${{ github.event.inputs.publish_docker == 'true' }}
needs: [maven-build]
runs-on: ubuntu-latest
environment: release
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: presto-artifacts-${{ env.VERSION }}
path: ./
- name: Login to dockerhub
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to gitHub container registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PRESTODB_CI_TOKEN }}
- name: Set up qemu
uses: docker/setup-qemu-action@v3
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3.9.0
- name: Create and use builder
run: |
docker buildx create --name container --use
docker buildx inspect --bootstrap
- name: Move artifacts to docker directory
run: |
mv ./presto-server/target/presto-server-*.tar.gz docker/
mv ./presto-cli/target/presto-cli-*-executable.jar docker/
- name: Build docker image and publish
uses: docker/build-push-action@v6
with:
context: docker
platforms: linux/amd64,linux/arm64,linux/ppc64le
file: docker/Dockerfile
push: true
build-args: |
PRESTO_VERSION=${{ env.VERSION }}
JMX_PROMETHEUS_JAVAAGENT_VERSION=0.20.0
tags: |
${{ env.DOCKER_REPO }}:${{ env.VERSION }}
${{ github.event.inputs.tag_image_as_latest == 'true' && format('{0}:latest', env.DOCKER_REPO) || '' }}
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
${{ github.event.inputs.tag_image_as_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}
publish-native-image:
if: ${{ github.event.inputs.publish_native_docker == 'true' }}
needs: [maven-build]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
environment: release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
submodules: true
- name: Initialize Prestissimo submodules
run: |
cd presto-native-execution && make submodules
echo "COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set dependency image tag
run: |
if [[ -n "${{ github.event.inputs.dependency_image }}" ]]; then
echo "DEPENDENCY_IMAGE=${{ github.event.inputs.dependency_image }}" >> $GITHUB_ENV
else
echo "DEPENDENCY_IMAGE=ghcr.io/${{ github.repository_owner }}/presto-native-dependency:${{ env.VERSION }}-${{ env.COMMIT_SHA }}" >> $GITHUB_ENV
fi
- name: Build Dependency Image
working-directory: presto-native-execution
run: |
if docker pull ${{ env.DEPENDENCY_IMAGE }}; then
echo "Using dependency image ${{ env.DEPENDENCY_IMAGE }}"
docker tag ${{ env.DEPENDENCY_IMAGE }} presto/prestissimo-dependency:centos9
else
echo "Building new depedency image"
docker compose build centos-native-dependency
docker tag presto/prestissimo-dependency:centos9 ghcr.io/${{ github.repository_owner }}/presto-native-dependency:${{ env.VERSION }}-${{ env.COMMIT_SHA }}
docker push ghcr.io/${{ github.repository_owner }}/presto-native-dependency:${{ env.VERSION }}-${{ env.COMMIT_SHA }}
fi
docker images
- name: Build Runtime Image
working-directory: presto-native-execution
run: |
if docker pull ghcr.io/${{ github.repository_owner }}/presto-native:${{ env.VERSION }}-${{ env.COMMIT_SHA }}; then
docker tag ghcr.io/${{ github.repository_owner }}/presto-native:${{ env.VERSION }}-${{ env.COMMIT_SHA }} docker.io/presto/prestissimo-runtime:centos9
else
docker compose build centos-native-runtime
docker tag presto/prestissimo-runtime:centos9 ghcr.io/${{ github.repository_owner }}/presto-native:${{ env.VERSION }}-${{ env.COMMIT_SHA }}
docker push ghcr.io/${{ github.repository_owner }}/presto-native:${{ env.VERSION }}-${{ env.COMMIT_SHA }}
fi
- name: Add release tag
working-directory: presto-native-execution
run: |
docker tag presto/prestissimo-runtime:centos9 ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
if [[ "${{ github.event.inputs.tag_image_as_latest }}" == "true" ]]; then
docker tag presto/prestissimo-runtime:centos9 ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:latest
fi
- name: Push to DockerHub
run: |
docker push ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
if [[ "${{ github.event.inputs.tag_image_as_latest }}" == "true" ]]; then
docker tag ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:latest
docker push ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:latest
fi
- name: Tag and push to GitHub Packages
run: |
docker tag ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
docker push ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
if [[ "${{ github.event.inputs.tag_image_as_latest }}" == "true" ]]; then
docker tag ${{ env.ORG_NAME }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }} ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
docker push ghcr.io/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
fi