Skip to content

Commit aa2eb72

Browse files
committed
fix with pattern + merge
1 parent 2afe620 commit aa2eb72

File tree

1 file changed

+17
-25
lines changed

1 file changed

+17
-25
lines changed

.github/workflows/_build-packages.yml

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,17 @@ defaults:
1919
shell: bash
2020

2121
jobs:
22-
init:
23-
runs-on: ubuntu-22.04
24-
steps:
25-
- uses: actions/checkout@v4
26-
- run: |
27-
mkdir dist && touch dist/.placeholder
28-
- name: Keep artifact
29-
id: keep-artifact
30-
run: python -c "print('DAYS=' + str(5 if '${{ github.event_name }}'.startswith('pull_request') else 0))" >> $GITHUB_OUTPUT
31-
- uses: actions/upload-artifact@v4
32-
with:
33-
name: ${{ inputs.artifact-name }}
34-
path: dist
35-
retention-days: ${{ steps.keep-artifact.outputs.DAYS }}
36-
include-hidden-files: true
3722

3823
build-packages:
39-
needs: init
4024
runs-on: ubuntu-22.04
4125
strategy:
42-
max-parallel: 1 # run sequential to prevent download/upload collisions
4326
matrix:
4427
pkg-name: ${{ fromJSON(inputs.pkg-names) }}
4528
steps:
4629
- uses: actions/checkout@v4
47-
- uses: actions/download-artifact@v4
48-
with:
49-
name: ${{ inputs.artifact-name }}
50-
path: pypi
51-
merge-multiple: true
5230
- uses: actions/setup-python@v5
5331
with:
54-
python-version: 3.9
32+
python-version: "3.x"
5533

5634
- run: python -c "print('NB_DIRS=' + str(2 if '${{ matrix.pkg-name }}' == 'pytorch' else 1))" >> $GITHUB_ENV
5735
- name: Build & check package
@@ -64,9 +42,23 @@ jobs:
6442
mkdir pypi/${{ matrix.pkg-name }}
6543
cp dist/* pypi/${{ matrix.pkg-name }}/
6644
45+
- uses: actions/upload-artifact@v4
46+
with:
47+
name: ${{ inputs.artifact-name }}-${{ matrix.pkg-name }}
48+
path: pypi
49+
50+
merge-artifacts:
51+
runs-on: ubuntu-22.04
52+
steps:
53+
- uses: actions/download-artifact@v4
54+
with: # download all build artifacts
55+
pattern: ${{ inputs.artifact-name }}-*
56+
merge-multiple: true
57+
path: pypi
58+
- name: Keep artifact
59+
run: python -c "print('DAYS=' + str(5 if '${{ github.event_name }}'.startswith('pull_request') else 0))" >> $GITHUB_ENV
6760
- uses: actions/upload-artifact@v4
6861
with:
6962
name: ${{ inputs.artifact-name }}
7063
path: pypi
71-
include-hidden-files: true
72-
overwrite: true
64+
retention-days: ${{ env.DAYS }}

0 commit comments

Comments
 (0)