Skip to content

Commit e95b9fd

Browse files
authored
[cherry-pick] chore: remove reusable publishing code, pypi does not allow it (#12482) (#12484)
(cherry picked from commit c6baff4) Signed-off-by: Humair Khan <[email protected]>
1 parent 665bd68 commit e95b9fd

File tree

2 files changed

+163
-119
lines changed

2 files changed

+163
-119
lines changed

.github/workflows/publish-package-reusable.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.github/workflows/publish-packages.yml

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

25+
env:
26+
PYTHON_VERSION: "3.9"
27+
2528
jobs:
2629
publish-kfp-pipeline-spec:
2730
if: ${{ github.event.inputs.packages == 'all' || github.event.inputs.packages == 'kfp-pipeline-spec' }}
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' }}
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/
3971

4072
publish-kfp-server-api:
4173
if: ${{ github.event.inputs.packages == 'all' || github.event.inputs.packages == 'kfp-server-api' }}
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' }}
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/
53114

54115
publish-kfp:
55116
if: ${{ github.event.inputs.packages == 'all' || github.event.inputs.packages == 'kfp' }}
56117
# Uncomment once all packages in PyPi are configured to be released from this repo.
57118
# needs: [publish-kfp-pipeline-spec, publish-kfp-server-api]
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' }}
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/
69159

70160
publish-kfp-kubernetes:
71161
if: ${{ github.event.inputs.packages == 'all' || github.event.inputs.packages == 'kfp-kubernetes' }}
72162
# Uncomment once all packages in PyPi are configured to be released from this repo.
73163
# needs: [publish-kfp-pipeline-spec, publish-kfp]
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' }}
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/

0 commit comments

Comments
 (0)