forked from PrefectHQ/prefect
-
Notifications
You must be signed in to change notification settings - Fork 0
336 lines (285 loc) · 10.1 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
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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
name: Release prefect
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+rc[0-9]+"
- "[0-9]+.[0-9]+[ab][0-9]+"
jobs:
build-release:
name: Build Python package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Versioneer only generates correct versions with a full fetch
fetch-depth: 0
persist-credentials: false
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: "pip"
cache-dependency-path: "requirements*.txt"
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache-dependency-path: "**/package-lock.json"
- name: Install python packages
run: |
python -m pip install --upgrade pip
pip install --upgrade --upgrade-strategy eager -e .[dev]
- name: Build orion-ui
run: |
prefect dev build-ui
- name: Build a binary wheel and a source tarball
run: |
python setup.py sdist
python setup.py bdist_wheel
- name: Publish build artifacts
uses: actions/upload-artifact@v3
with:
name: built-package
path: "./dist"
build-docker-images:
name: Build Docker images
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
steps:
# Not needed until we want multiarchecture builds
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate image metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: prefecthq/prefect
tags: |
type=pep440,pattern={{version}},suffix=-python${{ matrix.python-version }}
type=pep440,pattern={{major}}.{{minor}},suffix=-python${{ matrix.python-version }}
type=pep440,pattern={{major}},suffix=-python${{ matrix.python-version }}
type=sha,suffix=-python${{ matrix.python-version }}
type=raw,value=2-latest,enable=${{ matrix.python-version == '3.10'}}
flavor: |
latest=false
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build image
uses: docker/build-push-action@v3
with:
context: .
build-args: PYTHON_VERSION=${{ matrix.python-version }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
outputs: type=docker,dest=/tmp/image.tar
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test docker image
run: |
docker load --input /tmp/image.tar
docker run --rm prefecthq/prefect:sha-${GITHUB_SHA::7}-python${{ matrix.python-version }} prefect version
- name: Upload image artifact
uses: actions/upload-artifact@v3
# Images are stashed for publish after approval is given
with:
name: release-image-${{ github.sha }}-${{ matrix.python-version }}
path: /tmp/image.tar
build-conda-docker-images:
name: Build Conda Docker images
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
steps:
# Not needed until we want multiarchecture builds
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate image metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: prefecthq/prefect
tags: |
type=pep440,pattern={{version}},suffix=-python${{ matrix.python-version }}-conda
type=pep440,pattern={{major}}.{{minor}},suffix=-python${{ matrix.python-version }}-conda
type=pep440,pattern={{major}},suffix=-python${{ matrix.python-version }}-conda
type=sha,suffix=-python${{ matrix.python-version }}-conda
type=raw,value=2-latest-conda,enable=${{ matrix.python-version == '3.10'}}
flavor: |
latest=false
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build image
uses: docker/build-push-action@v3
with:
context: .
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
BASE_IMAGE=prefect-conda
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
outputs: type=docker,dest=/tmp/image-conda.tar
cache-from: type=gha
# We do not cache Conda image layers because they very big and slow to upload
# cache-to: type=gha,mode=max
- name: Test docker image
run: |
docker load --input /tmp/image-conda.tar
docker run --rm prefecthq/prefect:sha-${GITHUB_SHA::7}-python${{ matrix.python-version }}-conda prefect version
- name: Upload image artifact
uses: actions/upload-artifact@v3
# Images are stashed for publish after approval is given
with:
name: release-image-${{ github.sha }}-${{ matrix.python-version }}-conda
path: /tmp/image-conda.tar
publish-docs:
name: Publish documentation
needs: [build-release, publish-test-release]
environment: "prod"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Checkout current docs
run: git checkout docs-deploy --
- name: Create a temporary branch
# the release tag is parsed from the ref
run: git checkout -b "docs-for-release-${GITHUB_REF#refs/*/}"
- name: Merge with main
run: git merge origin/main --no-ff -m "Merge branch 'main' into temporary docs branch"
- name: Push and open PR
run: |
git push --set-upstream origin HEAD
gh pr create \
--title "Publish docs from release ${GITHUB_REF#refs/*/}" \
--body '_automatically created with `gh` cli on merge to `main`_' \
--base docs-deploy
gh pr merge --merge --delete-branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-test-release:
name: Publish release to Test PyPI
needs: [build-release]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: built-package
path: "./dist"
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
publish-release:
name: Publish to PyPI
environment: "prod"
needs: [build-release, publish-test-release]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: built-package
path: "./dist"
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
name: ci
publish-docker-images:
name: Publish to DockerHub
needs:
[
build-docker-images,
build-conda-docker-images,
build-release,
publish-test-release,
]
environment: "prod"
runs-on: ubuntu-latest
steps:
- name: Download image artifacts for Python 3.7
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.7
path: /tmp/3.7/
- name: Download image artifacts for Python 3.8
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.8
path: /tmp/3.8/
- name: Download image artifacts for Python 3.9
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.9
path: /tmp/3.9/
- name: Download image artifacts for Python 3.10
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.10
path: /tmp/3.10/
- name: Download conda image artifacts for Python 3.7
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.7-conda
path: /tmp/3.7/
- name: Download conda image artifacts for Python 3.8
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.8-conda
path: /tmp/3.8/
- name: Download conda image artifacts for Python 3.9
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.9-conda
path: /tmp/3.9/
- name: Download conda image artifacts for Python 3.10
uses: actions/download-artifact@v3
with:
name: release-image-${{ github.sha }}-3.10-conda
path: /tmp/3.10/
- name: Load images
run: |
docker load --input /tmp/3.7/image.tar
docker load --input /tmp/3.8/image.tar
docker load --input /tmp/3.9/image.tar
docker load --input /tmp/3.10/image.tar
docker load --input /tmp/3.7/image-conda.tar
docker load --input /tmp/3.8/image-conda.tar
docker load --input /tmp/3.9/image-conda.tar
docker load --input /tmp/3.10/image-conda.tar
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push images
run: |
docker image push --all-tags prefecthq/prefect