-
Notifications
You must be signed in to change notification settings - Fork 299
322 lines (316 loc) · 11.3 KB
/
pythonpublish.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
319
320
321
322
name: Publish Python Package
on:
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine setuptools wheel
- name: Put version in environment
id: bump
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
echo "version=$VERSION" >> $GITHUB_OUTPUT
shell: bash
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build
twine upload dist/*
- name: Autobump plugin version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
VERSION=$VERSION make -C plugins update_all_versions
shell: bash
- name: Build all Plugins and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
make -C plugins build_all_plugins
make -C plugins publish_all_plugins
- name: Sleep until pypi is available
id: pypiwait
run: |
# from refs/tags/v1.2.3 get 1.2.3 and make sure it's not an empty string
VERSION=$(echo $GITHUB_REF | sed 's#.*/v##')
if [ -z "$VERSION" ]
then
echo "No tagged version found, exiting"
exit 1
fi
sleep 300
LINK="https://pypi.org/project/flytekitplugins-pod/${VERSION}/"
for i in {1..60}; do
result=$(curl -L -I -s -f ${LINK})
if [ $? -eq 0 ]; then
echo "Found pypi for $LINK"
exit 0
else
echo "Did not find - Retrying in 10 seconds..."
sleep 10
fi
done
exit 1
shell: bash
outputs:
version: ${{ steps.bump.outputs.version }}
build-and-push-docker-images:
runs-on: ubuntu-latest
needs: deploy
strategy:
matrix:
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- 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 GitHub Container Registry
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: "${{ secrets.FLYTE_BOT_USERNAME }}"
password: "${{ secrets.FLYTE_BOT_PAT }}"
- name: Prepare Flytekit Image Names
id: flytekit-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flytekit
tags: |
py${{ matrix.python-version }}-latest
py${{ matrix.python-version }}-${{ github.sha }}
py${{ matrix.python-version }}-${{ needs.deploy.outputs.version }}
- name: Build & Push Flytekit Python${{ matrix.python-version }} Docker Image to Github Registry
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/arm64, linux/amd64
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.flytekit-names.outputs.tags }}
build-args: |
VERSION=${{ needs.deploy.outputs.version }}
DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/flytekit:py${{ matrix.python-version }}-${{ needs.deploy.outputs.version }}
PYTHON_VERSION=${{ matrix.python-version }}
file: Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Prepare SQLAlchemy Image Names
id: sqlalchemy-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flytekit
tags: |
py${{ matrix.python-version }}-sqlalchemy-latest
py${{ matrix.python-version }}-sqlalchemy-${{ github.sha }}
py${{ matrix.python-version }}-sqlalchemy-${{ needs.deploy.outputs.version }}
- name: Push SQLAlchemy Image to GitHub Registry
uses: docker/build-push-action@v2
with:
context: "./plugins/flytekit-sqlalchemy/"
platforms: linux/arm64, linux/amd64
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.sqlalchemy-names.outputs.tags }}
build-args: |
VERSION=${{ needs.deploy.outputs.version }}
PYTHON_VERSION=${{ matrix.python-version }}
file: ./plugins/flytekit-sqlalchemy/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Prepare OpenAI Batch Image Names
id: openai-batch-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flytekit
tags: |
py${{ matrix.python-version }}-openai-batch-latest
py${{ matrix.python-version }}-openai-batch-${{ github.sha }}
py${{ matrix.python-version }}-openai-batch-${{ needs.deploy.outputs.version }}
- name: Push OpenAI Batch Image to GitHub Registry
uses: docker/build-push-action@v2
with:
context: "./plugins/flytekit-openai/"
platforms: linux/arm64, linux/amd64
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.openai-batch-names.outputs.tags }}
build-args: |
VERSION=${{ needs.deploy.outputs.version }}
PYTHON_VERSION=${{ matrix.python-version }}
file: ./plugins/flytekit-openai/Dockerfile.batch
cache-from: type=gha
cache-to: type=gha,mode=max
build-and-push-flyteagent-images:
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- 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 GitHub Container Registry
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: "${{ secrets.FLYTE_BOT_USERNAME }}"
password: "${{ secrets.FLYTE_BOT_PAT }}"
- name: Prepare Flyte Agent Slim Image Names
id: flyteagent-slim-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flyteagent-slim
tags: |
latest
${{ github.sha }}
${{ needs.deploy.outputs.version }}
- name: Prepare Flyte Agent Image Names
id: flyteagent-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flyteagent
tags: |
latest
${{ github.sha }}
${{ needs.deploy.outputs.version }}
- name: Push flyteagent-slim Image to GitHub Registry
uses: docker/build-push-action@v2
with:
context: "."
platforms: linux/arm64, linux/amd64
target: agent-slim
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.flyteagent-slim-names.outputs.tags }}
build-args: |
VERSION=${{ needs.deploy.outputs.version }}
file: ./Dockerfile.agent
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Push flyteagent-all Image to GitHub Registry
uses: docker/build-push-action@v2
with:
context: "."
platforms: linux/arm64, linux/amd64
target: agent-all
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.flyteagent-names.outputs.tags }}
build-args: |
VERSION=${{ needs.deploy.outputs.version }}
file: ./Dockerfile.agent
cache-from: type=gha
cache-to: type=gha,mode=max
build-and-push-spark-images:
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- 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 GitHub Container Registry
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: "${{ secrets.FLYTE_BOT_USERNAME }}"
password: "${{ secrets.FLYTE_BOT_PAT }}"
- name: Prepare Spark Image Names
id: spark-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flytekit
tags: |
spark-latest
spark-${{ github.sha }}
spark-${{ needs.deploy.outputs.version }}
- name: Push Spark Image to GitHub Registry
uses: docker/build-push-action@v2
with:
context: "./plugins/flytekit-spark/"
platforms: linux/arm64, linux/amd64
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.spark-names.outputs.tags }}
build-args: |
VERSION=${{ needs.deploy.outputs.version }}
file: ./plugins/flytekit-spark/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-and-push-flyteinteractive-images:
runs-on: ubuntu-latest
needs: deploy
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- 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 GitHub Container Registry
if: ${{ github.event_name == 'release' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: "${{ secrets.FLYTE_BOT_USERNAME }}"
password: "${{ secrets.FLYTE_BOT_PAT }}"
- name: Prepare flyteinteractive Image Names
id: flyteinteractive-names
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/${{ github.repository_owner }}/flytekit
tags: |
flyteinteractive-latest
flyteinteractive-${{ github.sha }}
flyteinteractive-${{ needs.deploy.outputs.version }}
- name: Push Flyin Image to GitHub Registry
uses: docker/build-push-action@v2
with:
context: "./plugins/flytekit-flyteinteractive/"
platforms: linux/arm64, linux/amd64
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.flyteinteractive-names.outputs.tags }}
build-args: |
VERSION=${{ needs.deploy.outputs.version }}
file: ./plugins/flytekit-flyteinteractive/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max