Skip to content

Commit 6dcad44

Browse files
committed
actions: publish-wheels: support publishing GPL sources
Publish GPL sources alongside our wheels if they're present so we can be license compliant. AI-Generated: Uses Claude Sonnet 5 Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
1 parent 3e55a36 commit 6dcad44

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

actions/publish-wheels/action.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,35 @@ inputs:
5757
required: false
5858
default: ''
5959

60+
gpl-sources-artifact:
61+
description: >
62+
Name of an artifact (produced by an earlier job in the caller workflow)
63+
containing a gpl-sources.tar file with bundled GPL source packages
64+
(e.g. a manylinux toolchain's src.rpm, collected via
65+
collect-gpl-sources). When set, it is downloaded, published
66+
as an asset on the GitHub Release named by gpl-sources-release-tag,
67+
and linked in the docs PR opened by update_doc.py. Leave empty to skip
68+
GPL sources publishing entirely.
69+
required: false
70+
default: ''
71+
72+
gpl-sources-release-tag:
73+
description: >
74+
Git tag for the GitHub Release that hosts the gpl-sources-artifact
75+
asset, e.g. "numpy-v2.5.1". Required when gpl-sources-artifact is set;
76+
the release is created if it doesn't already exist.
77+
required: false
78+
default: ''
79+
80+
gpl-sources-description:
81+
description: >
82+
Short parenthetical describing what's bundled in the GPL sources
83+
artifact, e.g. "gcc". Rendered in the docs comment as
84+
"... bundled GPL libraries (gcc)". Only used when gpl-sources-artifact
85+
is set.
86+
required: false
87+
default: ''
88+
6089
runs:
6190
using: 'composite'
6291
steps:
@@ -83,6 +112,40 @@ runs:
83112
skip-existing: ${{ inputs.skip-existing }}
84113
twine-version: ${{ inputs.twine-version }}
85114

115+
- name: Download GPL sources artifact
116+
if: inputs.gpl-sources-artifact != ''
117+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
118+
with:
119+
name: ${{ inputs.gpl-sources-artifact }}
120+
path: gpl-sources
121+
122+
- name: Publish GPL sources as a GitHub Release asset
123+
if: inputs.gpl-sources-artifact != ''
124+
shell: bash
125+
env:
126+
GH_TOKEN: ${{ inputs.gh-token }}
127+
run: |
128+
set -euo pipefail
129+
130+
tag="${{ inputs.gpl-sources-release-tag }}"
131+
if [[ -z "$tag" ]]; then
132+
echo "::error::gpl-sources-release-tag must be set when gpl-sources-artifact is used."
133+
exit 1
134+
fi
135+
136+
asset="gpl-sources/gpl-sources.tar"
137+
138+
if gh release view "$tag" --repo "${{ github.repository }}" >/dev/null 2>&1; then
139+
gh release upload "$tag" "$asset" --repo "${{ github.repository }}" --clobber
140+
else
141+
gh release create "$tag" "$asset" \
142+
--repo "${{ github.repository }}" \
143+
--title "$tag" \
144+
--notes "Bundled GPL source packages for $tag."
145+
fi
146+
147+
echo "GPL_SOURCES_URL=https://github.com/${{ github.repository }}/releases/download/$tag/gpl-sources.tar" >> "$GITHUB_ENV"
148+
86149
- uses: actions/setup-python@v5
87150
with:
88151
python-version: '3'
@@ -96,4 +159,6 @@ runs:
96159
env:
97160
GH_TOKEN: ${{ inputs.gh-token }}
98161
ARTIFACTS_PATH: ${{ inputs.artifact-path }}
162+
GPL_SOURCES_URL: ${{ env.GPL_SOURCES_URL }}
163+
GPL_SOURCES_DESCRIPTION: ${{ inputs.gpl-sources-description }}
99164
run: python3 ci_scripts/update_doc.py

0 commit comments

Comments
 (0)