-
Notifications
You must be signed in to change notification settings - Fork 52
249 lines (216 loc) · 6.96 KB
/
Copy pathrelease.yml
File metadata and controls
249 lines (216 loc) · 6.96 KB
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
name: release
on:
workflow_dispatch:
inputs:
registry:
description: 'Container registry prefix (e.g., ghcr.io/trinodb)'
required: false
default: 'ghcr.io/trinodb'
jobs:
prepare:
runs-on: ubuntu-24.04
permissions:
contents: write
outputs:
commit_sha: ${{ steps.release.outputs.COMMIT_SHA }}
steps:
- uses: actions/checkout@v6
- name: Configure Git user
run: |
git config user.email "releases@trinodb.io"
git config user.name "Trino release automation"
- name: Create release commit
id: release
run: |
if ! grep -q '^[0-9]\+-SNAPSHOT$' version; then
echo "Error: version file must contain SNAPSHOT version (e.g., 124-SNAPSHOT)"
exit 1
fi
sed -i 's/^\([0-9]\+\)-SNAPSHOT$/\1/' version
VERSION=$(cat version)
git commit -a -m "Release: $VERSION"
git push origin HEAD:master
echo "COMMIT_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
release-amd64:
needs: prepare
runs-on: ubuntu-24.04
permissions:
packages: write
env:
REGISTRY: ${{ inputs.registry }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.commit_sha }}
- name: Free up disk space
run: ./.github/bin/free-disk-space.sh
- name: Log in to the Container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install crane
uses: imjasonh/setup-crane@31b88efe9de28ae0ffa220711af4b60be9435f6e # v0.4
- name: Build and push amd64 images
run: |
multi_arch=(
build/sphinx
testing/almalinux9-oj11
testing/almalinux9-oj17
testing/almalinux9-oj17-openldap
testing/almalinux9-oj17-openldap-referrals
testing/hive3.1
testing/hive3.1-hive
testing/hive3.1-kerberos
testing/iceberg-rest
testing/kdc
testing/spark4-delta
testing/spark4-iceberg
testing/spark3-hudi
testing/hive4.0-hive
)
mkdir -p /tmp/refs
# Build and push multi_arch amd64 images by digest
for image in "${multi_arch[@]}"; do
make "$image"
SAFE_NAME="${image//\//-}"
docker save "${image}:latest" -o /tmp/image.tar
crane push /tmp/image.tar "${REGISTRY}/${image}" --image-refs "/tmp/refs/${SAFE_NAME}-linux-amd64"
done
- name: Upload refs
uses: actions/upload-artifact@v7
with:
name: refs-amd64
path: /tmp/refs/*
release-arm64:
needs: prepare
runs-on: ubuntu-24.04-arm
permissions:
packages: write
env:
REGISTRY: ${{ inputs.registry }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.commit_sha }}
- name: Free up disk space
run: ./.github/bin/free-disk-space.sh
- name: Log in to the Container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install crane
uses: imjasonh/setup-crane@31b88efe9de28ae0ffa220711af4b60be9435f6e # v0.4
- name: Build and push arm64 images
run: |
multi_arch=(
build/sphinx
testing/almalinux9-oj11
testing/almalinux9-oj17
testing/almalinux9-oj17-openldap
testing/almalinux9-oj17-openldap-referrals
testing/hive3.1
testing/hive3.1-hive
testing/hive3.1-kerberos
testing/hive4.0-hive
testing/iceberg-rest
testing/kdc
testing/spark4-delta
testing/spark4-iceberg
testing/spark3-hudi
)
mkdir -p /tmp/refs
# Build and push multi_arch arm64 images by digest
for image in "${multi_arch[@]}"; do
make "$image"
SAFE_NAME="${image//\//-}"
docker save "${image}:latest" -o /tmp/image.tar
crane push /tmp/image.tar "${REGISTRY}/${image}" --image-refs "/tmp/refs/${SAFE_NAME}-linux-arm64"
done
- name: Upload refs
uses: actions/upload-artifact@v7
with:
name: refs-arm64
path: /tmp/refs/*
create-manifests:
needs: [prepare, release-amd64, release-arm64]
runs-on: ubuntu-24.04
permissions:
packages: write
env:
REGISTRY: ${{ inputs.registry }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.commit_sha }}
- name: Log in to the Container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install crane
uses: imjasonh/setup-crane@31b88efe9de28ae0ffa220711af4b60be9435f6e # v0.4
- name: Download refs
uses: actions/download-artifact@v8
with:
path: /tmp/refs
pattern: refs-*
merge-multiple: true
- name: Set version from file
run: echo "VERSION=$(cat version)" >> $GITHUB_ENV
- name: Create and push manifests
run: |
multi_arch=(
build/sphinx
testing/almalinux9-oj11
testing/almalinux9-oj17
testing/almalinux9-oj17-openldap
testing/almalinux9-oj17-openldap-referrals
testing/hive3.1
testing/hive3.1-hive
testing/hive3.1-kerberos
testing/hive4.0-hive
testing/iceberg-rest
testing/kdc
testing/spark4-delta
testing/spark4-iceberg
testing/spark3-hudi
)
# Create multi-arch manifests for images with both platforms
for image in "${multi_arch[@]}"; do
SAFE_NAME="${image//\//-}"
AMD64_REF=$(cat "/tmp/refs/${SAFE_NAME}-linux-amd64")
ARM64_REF=$(cat "/tmp/refs/${SAFE_NAME}-linux-arm64")
crane index append -t "${REGISTRY}/${image}:${VERSION}" \
-m "$AMD64_REF" \
-m "$ARM64_REF"
done
finalize:
needs: [prepare, create-manifests]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.prepare.outputs.commit_sha }}
- name: Configure Git user
run: |
git config user.email "releases@trinodb.io"
git config user.name "Trino release automation"
- name: Create release tag
run: |
VERSION=$(cat version)
git tag -m "" "$VERSION"
- name: Create next development version
run: |
VERSION=$(cat version)
((VERSION++))
echo "$VERSION-SNAPSHOT" > version
git commit -a -m "Prepare for next development iteration"
- name: Push changes
run: git push --tags origin HEAD:master