Skip to content

Commit a411512

Browse files
committed
split build and publish
1 parent 3d0897c commit a411512

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

.github/workflows/build.yaml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,29 @@ jobs:
147147
branch: ${{ steps.get_branch.outputs.branch }}
148148
folder: dist
149149

150+
build:
151+
needs: test
152+
runs-on: ubuntu-latest
153+
steps:
154+
- uses: actions/checkout@v4
155+
- uses: actions/setup-python@v6
156+
with:
157+
python-version: '3.10'
158+
cache: 'pip'
159+
- name: Install dependencies
160+
run: |
161+
python -m pip install --upgrade pip
162+
pip --version
163+
pip install --upgrade build
164+
pip install .
165+
- name: Build package
166+
run: |
167+
python -m build
168+
- uses: actions/upload-artifact@v4
169+
with:
170+
path: dist/
171+
name: dist
172+
150173
conda-build:
151174
needs: test
152175
runs-on: ubuntu-latest
@@ -186,9 +209,8 @@ jobs:
186209
# with:
187210
# recipe-path: conda-recipe/recipe.yaml
188211

189-
pip-build:
190-
name: Build and publish to PyPI
191-
needs: [deploy, conda-build]
212+
publish:
213+
needs: [build, conda-build]
192214
runs-on: ubuntu-latest
193215
environment:
194216
name: release
@@ -200,17 +222,6 @@ jobs:
200222
uses: actions/checkout@v4
201223
with:
202224
fetch-depth: 2
203-
- name: Set up Python
204-
uses: actions/setup-python@v6
205-
with:
206-
python-version: '3.10'
207-
cache: 'pip'
208-
- name: Install dependencies
209-
run: |
210-
python -m pip install --upgrade pip
211-
pip --version
212-
pip install --upgrade build
213-
pip install .
214225
- name: Check if there is a parent commit
215226
id: check-parent-commit
216227
run: |
@@ -231,11 +242,10 @@ jobs:
231242
with:
232243
github_token: ${{ secrets.GITHUB_TOKEN }}
233244
custom_tag: ${{ steps.check-version.outputs.current-version }}
234-
235-
- name: Build package
236-
run: |
237-
python -m build
238-
245+
- uses: actions/download-artifact@v4
246+
if: github.ref == 'refs/heads/main' && steps.tag-version.outputs.new_tag
247+
with:
248+
name: dist
239249
- name: Publish package on PyPI
240250
if: github.ref == 'refs/heads/main' && steps.tag-version.outputs.new_tag
241251
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)