@@ -129,9 +129,15 @@ when invoked.
129129### Using the python-wheels Repository in Workflows
130130
131131The ` python-wheels ` repository contains some custom Actions we require, and
132- patch files to apply for certain projects. The most critical example is the
133- ` publish-to-gitlab ` Action. With it in place, the ` build-numpy.yml ` script's
134- ` publish ` job looks like this:
132+ patch files to apply for certain projects. The one every ` build-<package>.yml `
133+ workflow needs is ` publish-wheels ` , which performs the following steps:
134+
135+ 1 . Downloads the built wheel(s) from the previous job
136+ 2 . Uploads them to the GitLab PyPI registry (via the lower-level
137+ ` publish-to-gitlab ` Action)
138+ 3 . Opens a PR against ` docs/packages/<name>.md ` documenting the new version (via
139+ ` ci_scripts/update_doc.py ` ). With it in place, the ` build-numpy.yml ` script's
140+ ` publish ` job looks like this:
135141
136142```
137143publish:
@@ -143,29 +149,28 @@ publish:
143149 if: github.ref == 'refs/heads/main'
144150 runs-on: ubuntu-latest
145151 permissions:
146- contents: read
152+ contents: write
153+ pull-requests: write
147154
148155 steps:
149- - name: Download wheels
150- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
151- with:
152- pattern: numpy-${{ env.NUMPY_VERSION }}-*-manylinux_riscv64
153- path: dist
154- merge-multiple: true
155-
156- - name: Publish to GitLab PyPI registry
157- uses: riseproject-dev/python-wheels/actions/publish-to-gitlab@main
156+ - name: Publish wheels and open docs PR
157+ uses: riseproject-dev/python-wheels/actions/publish-wheels@main
158158 with:
159+ artifact-pattern: numpy-${{ env.NUMPY_VERSION }}-*-manylinux_riscv64
159160 gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }}
160161 gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }}
161162 gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }}
162- files: |
163- dist/*.whl
163+ gh-token: ${{ secrets.GITHUB_TOKEN }}
164164```
165165
166- Other workflows need to follow a similar process - checkout the ` python-wheels `
167- repo, and run the ` publish-to-gitlab ` action to upload built wheels to the RISE
168- Python registry.
166+ ` permissions ` needs ` contents: write ` and ` pull-requests: write ` here (not just
167+ ` contents: read ` ) since the docs step pushes a branch and opens a PR with the
168+ default ` GITHUB_TOKEN ` .
169+
170+ Other workflows need to follow the same process, modifying ` artifact-pattern ` to
171+ match their own artifact naming scheme and otherwise reusing ` publish-wheels `
172+ like the example. The ` publish-to-gitlab ` Action should only be used directly if
173+ a workflow needs the upload step without the docs PR side effect.
169174
170175## Testing a New Workflow
171176
0 commit comments