Skip to content

Commit 54a4b00

Browse files
committed
CI: attach wheel and conda artifacts to GitHub releases
1 parent 9741242 commit 54a4b00

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,46 @@ jobs:
327327
attestations: false
328328
user: __token__
329329
password: ${{ secrets.PYPI_TOKEN }}
330+
331+
attach_release_assets:
332+
name: Attach wheel and conda artifacts to release
333+
needs: [build_wheels, build_conda, test]
334+
if: github.event_name == 'release' && github.event.release.target_commitish == 'main'
335+
runs-on: ubuntu-latest
336+
permissions:
337+
contents: write
338+
steps:
339+
- name: Download wheel artifacts
340+
uses: actions/download-artifact@v4
341+
with:
342+
pattern: wheels-*
343+
path: dist/wheels
344+
merge-multiple: true
345+
346+
- name: Download conda artifacts
347+
uses: actions/download-artifact@v4
348+
with:
349+
pattern: conda-*
350+
path: dist/conda
351+
merge-multiple: true
352+
353+
- name: Show collected release artifacts
354+
shell: bash
355+
run: |
356+
shopt -s nullglob globstar
357+
files=(dist/wheels/*.whl dist/conda/**/labellib-*.tar.bz2 dist/conda/**/labellib-*.conda)
358+
if [ ${#files[@]} -eq 0 ]; then
359+
echo "No wheel or conda artifacts found to attach to release."
360+
exit 1
361+
fi
362+
printf '%s\n' "${files[@]}"
363+
364+
- name: Upload artifacts to GitHub release
365+
uses: softprops/action-gh-release@v2
366+
with:
367+
tag_name: ${{ github.event.release.tag_name }}
368+
files: |
369+
dist/wheels/*.whl
370+
dist/conda/**/labellib-*.tar.bz2
371+
dist/conda/**/labellib-*.conda
372+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)