Skip to content

Commit c6604f3

Browse files
authored
chore: update release process (#12359)
Signed-off-by: Humair Khan <[email protected]>
1 parent 5cf8c36 commit c6604f3

File tree

4 files changed

+168
-230
lines changed

4 files changed

+168
-230
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Publish Python Package (Reusable)
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
package_name:
7+
type: string
8+
required: true
9+
description: "Name of the package (e.g., kfp-pipeline-spec)"
10+
build_dir:
11+
type: string
12+
required: true
13+
description: "Directory to build from"
14+
dist_path:
15+
type: string
16+
required: true
17+
description: "Path to distribution artifacts"
18+
build_commands:
19+
type: string
20+
required: true
21+
description: "Build commands to execute"
22+
tag:
23+
type: string
24+
required: true
25+
description: "Git tag to checkout"
26+
dry_run:
27+
type: boolean
28+
required: true
29+
description: "Dry run - build packages without publishing to PyPI"
30+
31+
env:
32+
PYTHON_VERSION: "3.9"
33+
34+
jobs:
35+
publish:
36+
environment:
37+
name: pypi
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: read
41+
id-token: write
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
45+
with:
46+
ref: ${{ inputs.tag }}
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ env.PYTHON_VERSION }}
52+
53+
- name: Install build dependencies
54+
run: |
55+
python -m pip install --upgrade pip
56+
pip install build twine
57+
58+
- name: Build ${{ inputs.package_name }}
59+
run: |
60+
cd ${{ inputs.build_dir }}
61+
${{ inputs.build_commands }}
62+
63+
- name: Publish to PyPI
64+
if: ${{ inputs.dry_run == false }}
65+
uses: pypa/gh-action-pypi-publish@release/v1
66+
with:
67+
packages-dir: ${{ inputs.dist_path }}
68+
print-hash: true
69+
70+
- name: Upload artifacts (dry run)
71+
if: ${{ inputs.dry_run == true }}
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: ${{ inputs.package_name }}-dist
75+
path: ${{ inputs.dist_path }}

.github/workflows/publish-packages.yml

Lines changed: 44 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -22,182 +22,63 @@ on:
2222
default: true
2323
description: "Dry run - build packages without publishing to PyPI"
2424

25-
env:
26-
PYTHON_VERSION: "3.9"
27-
2825
jobs:
2926
publish-kfp-pipeline-spec:
3027
if: ${{ github.event.inputs.packages == 'all' || github.event.inputs.packages == 'kfp-pipeline-spec' }}
31-
runs-on: ubuntu-latest
32-
permissions:
33-
contents: read
34-
id-token: write
35-
steps:
36-
- name: Checkout code
37-
uses: actions/checkout@v4
38-
with:
39-
ref: ${{ github.event.inputs.tag }}
40-
41-
- name: Set up Python
42-
uses: actions/setup-python@v5
43-
with:
44-
python-version: ${{ env.PYTHON_VERSION }}
45-
46-
- name: Install build dependencies
47-
run: |
48-
python -m pip install --upgrade pip
49-
pip install build twine
50-
51-
- name: Build kfp-pipeline-spec
52-
run: |
53-
cd api
54-
make python
55-
cd v2alpha1/python
56-
twine check dist/*
57-
58-
- name: Publish to PyPI
59-
if: ${{ github.event.inputs.dry_run == 'false' }}
60-
uses: pypa/gh-action-pypi-publish@release/v1
61-
with:
62-
packages-dir: api/v2alpha1/python/dist/
63-
print-hash: true
64-
65-
- name: Upload artifacts (dry run)
66-
if: ${{ github.event.inputs.dry_run == 'true' }}
67-
uses: actions/upload-artifact@v4
68-
with:
69-
name: kfp-pipeline-spec-dist
70-
path: api/v2alpha1/python/dist/
28+
uses: ./.github/workflows/publish-package-reusable.yml
29+
with:
30+
package_name: kfp-pipeline-spec
31+
build_dir: api
32+
dist_path: api/v2alpha1/python/dist/
33+
build_commands: |
34+
make python
35+
cd v2alpha1/python
36+
twine check dist/*
37+
tag: ${{ github.event.inputs.tag }}
38+
dry_run: ${{ github.event.inputs.dry_run == 'true' }}
7139

7240
publish-kfp-server-api:
7341
if: ${{ github.event.inputs.packages == 'all' || github.event.inputs.packages == 'kfp-server-api' }}
74-
runs-on: ubuntu-latest
75-
permissions:
76-
contents: read
77-
id-token: write
78-
steps:
79-
- name: Checkout code
80-
uses: actions/checkout@v4
81-
with:
82-
ref: ${{ github.event.inputs.tag }}
83-
84-
- name: Set up Python
85-
uses: actions/setup-python@v5
86-
with:
87-
python-version: ${{ env.PYTHON_VERSION }}
88-
89-
- name: Install build dependencies
90-
run: |
91-
python -m pip install --upgrade pip
92-
pip install twine
93-
94-
- name: Build kfp-server-api
95-
run: |
96-
cd backend/api/v2beta1/python_http_client
97-
rm -rf dist
98-
python setup.py --quiet sdist
99-
twine check dist/*
100-
101-
- name: Publish to PyPI
102-
if: ${{ github.event.inputs.dry_run == 'false' }}
103-
uses: pypa/gh-action-pypi-publish@release/v1
104-
with:
105-
packages-dir: backend/api/v2beta1/python_http_client/dist/
106-
print-hash: true
107-
108-
- name: Upload artifacts (dry run)
109-
if: ${{ github.event.inputs.dry_run == 'true' }}
110-
uses: actions/upload-artifact@v4
111-
with:
112-
name: kfp-server-api-dist
113-
path: backend/api/v2beta1/python_http_client/dist/
42+
uses: ./.github/workflows/publish-package-reusable.yml
43+
with:
44+
package_name: kfp-server-api
45+
build_dir: backend/api/v2beta1/python_http_client
46+
dist_path: backend/api/v2beta1/python_http_client/dist/
47+
build_commands: |
48+
rm -rf dist
49+
python setup.py --quiet sdist
50+
twine check dist/*
51+
tag: ${{ github.event.inputs.tag }}
52+
dry_run: ${{ github.event.inputs.dry_run == 'true' }}
11453

11554
publish-kfp:
11655
if: ${{ github.event.inputs.packages == 'all' || github.event.inputs.packages == 'kfp' }}
11756
# Uncomment once all packages in PyPi are configured to be released from this repo.
11857
# needs: [publish-kfp-pipeline-spec, publish-kfp-server-api]
119-
runs-on: ubuntu-latest
120-
permissions:
121-
contents: read
122-
id-token: write
123-
steps:
124-
- name: Checkout code
125-
uses: actions/checkout@v4
126-
with:
127-
ref: ${{ github.event.inputs.tag }}
128-
129-
- name: Set up Python
130-
uses: actions/setup-python@v5
131-
with:
132-
python-version: ${{ env.PYTHON_VERSION }}
133-
134-
- name: Install build dependencies
135-
run: |
136-
python -m pip install --upgrade pip
137-
pip install build twine
138-
139-
- name: Build kfp
140-
run: |
141-
cd sdk
142-
make python
143-
cd python
144-
twine check dist/*
145-
146-
- name: Publish to PyPI
147-
if: ${{ github.event.inputs.dry_run == 'false' }}
148-
uses: pypa/gh-action-pypi-publish@release/v1
149-
with:
150-
packages-dir: sdk/python/dist/
151-
print-hash: true
152-
153-
- name: Upload artifacts (dry run)
154-
if: ${{ github.event.inputs.dry_run == 'true' }}
155-
uses: actions/upload-artifact@v4
156-
with:
157-
name: kfp-dist
158-
path: sdk/python/dist/
58+
uses: ./.github/workflows/publish-package-reusable.yml
59+
with:
60+
package_name: kfp
61+
build_dir: sdk
62+
dist_path: sdk/python/dist/
63+
build_commands: |
64+
make python
65+
cd python
66+
twine check dist/*
67+
tag: ${{ github.event.inputs.tag }}
68+
dry_run: ${{ github.event.inputs.dry_run == 'true' }}
15969

16070
publish-kfp-kubernetes:
16171
if: ${{ github.event.inputs.packages == 'all' || github.event.inputs.packages == 'kfp-kubernetes' }}
16272
# Uncomment once all packages in PyPi are configured to be released from this repo.
16373
# needs: [publish-kfp-pipeline-spec, publish-kfp]
164-
runs-on: ubuntu-latest
165-
permissions:
166-
contents: read
167-
id-token: write
168-
steps:
169-
- name: Checkout code
170-
uses: actions/checkout@v4
171-
with:
172-
ref: ${{ github.event.inputs.tag }}
173-
174-
- name: Set up Python
175-
uses: actions/setup-python@v5
176-
with:
177-
python-version: ${{ env.PYTHON_VERSION }}
178-
179-
- name: Install build dependencies
180-
run: |
181-
python -m pip install --upgrade pip
182-
pip install build twine
183-
184-
- name: Build kfp-kubernetes
185-
run: |
186-
cd kubernetes_platform
187-
make python
188-
cd python
189-
twine check dist/*
190-
191-
- name: Publish to PyPI
192-
if: ${{ github.event.inputs.dry_run == 'false' }}
193-
uses: pypa/gh-action-pypi-publish@release/v1
194-
with:
195-
packages-dir: kubernetes_platform/python/dist/
196-
print-hash: true
197-
198-
- name: Upload artifacts (dry run)
199-
if: ${{ github.event.inputs.dry_run == 'true' }}
200-
uses: actions/upload-artifact@v4
201-
with:
202-
name: kfp-kubernetes-dist
203-
path: kubernetes_platform/python/dist/
74+
uses: ./.github/workflows/publish-package-reusable.yml
75+
with:
76+
package_name: kfp-kubernetes
77+
build_dir: kubernetes_platform
78+
dist_path: kubernetes_platform/python/dist/
79+
build_commands: |
80+
make python
81+
cd python
82+
twine check dist/*
83+
tag: ${{ github.event.inputs.tag }}
84+
dry_run: ${{ github.event.inputs.dry_run == 'true' }}

.github/workflows/validate-generated-files.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
- 'sdk/**/*.py'
2121
- '!**/*.md'
2222
- '!**/OWNERS'
23+
- 'VERSION'
2324

2425
jobs:
2526
validate-generated-files:

0 commit comments

Comments
 (0)