@@ -256,6 +256,57 @@ If either point is not met, we should follow the [Patching a
256256Project] ( #patching-a-project ) process for patching our build, and submit an
257257issue and/or PR upstream to help them comply with license requirements as well.
258258
259+ #### Publishing GPL Sources
260+
261+ Some builds statically or dynamically link against GPL-licensed components
262+ that aren't part of the upstream project itself, but come from our build
263+ environment - most commonly the toolchain baked into the manylinux_riscv64
264+ container (e.g. ` gcc ` ). As the distributor of the resulting wheel, we need to
265+ make the corresponding source available permanently, not just for as long as
266+ a CI job's artifacts happen to be retained.
267+
268+ Use the ` collect-gpl-sources ` action in a job alongside
269+ ` build_wheels ` to pull the same container image and bundle the source RPM(s)
270+ for one or more installed packages into a ` gpl-sources.tar ` artifact:
271+
272+ ```
273+ gpl_sources:
274+ name: Collect GPL sources (gcc) for <package> ${{ inputs.version }}
275+ runs-on: ubuntu-24.04-riscv
276+ steps:
277+ - name: Collect gcc source RPM from manylinux_riscv64
278+ uses: riseproject-dev/python-wheels/actions/collect-gpl-sources@main
279+ with:
280+ image: ${{ env.MANYLINUX_RISCV64_IMAGE }}
281+ packages: gcc
282+ output: gpl-sources.tar
283+
284+ - uses: actions/upload-artifact@v7
285+ with:
286+ name: <package>-${{ inputs.version }}-gpl-sources
287+ path: gpl-sources.tar
288+ if-no-files-found: error
289+ ```
290+
291+ Pin ` MANYLINUX_RISCV64_IMAGE ` as a workflow-level ` env ` and pass it to both
292+ ` CIBW_MANYLINUX_RISCV64_IMAGE ` in the build job and this job, so the sources
293+ collected actually correspond to the toolchain that produced the wheels (see
294+ ` build-numpy.yml ` for a complete example).
295+
296+ Then add ` gpl_sources ` to the ` publish ` job's ` needs: ` , and pass the artifact
297+ through to ` publish-wheels ` :
298+
299+ ```
300+ gpl-sources-artifact: <package>-${{ inputs.version }}-gpl-sources
301+ gpl-sources-release-tag: <package>-v${{ inputs.version }}
302+ gpl-sources-description: gcc
303+ ```
304+
305+ ` publish-wheels ` publishes the tar as a permanent asset on a GitHub Release
306+ (created if it doesn't already exist) and passes its download URL to
307+ ` ci_scripts/update_doc.py ` , which renders it as a ` comment: ` on the new
308+ version entry automatically - no manual doc edit needed.
309+
259310### Adding Builds for Rust Packages
260311
261312Modules which are cross-compiled from Rust to Python typically use
0 commit comments