@@ -129,9 +129,16 @@ 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>.yaml ` documenting the new version
139+ (via ` ci_scripts/update_doc.py ` ), which ` docs/packages/generate_packages_doc.py `
140+ later renders into the published Markdown page. With it in place, the
141+ ` build-numpy.yml ` script's ` publish ` job looks like this:
135142
136143```
137144publish:
@@ -143,29 +150,28 @@ publish:
143150 if: github.ref == 'refs/heads/main'
144151 runs-on: ubuntu-latest
145152 permissions:
146- contents: read
153+ contents: write
154+ pull-requests: write
147155
148156 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
157+ - name: Publish wheels and open docs PR
158+ uses: riseproject-dev/python-wheels/actions/publish-wheels@main
158159 with:
160+ artifact-pattern: numpy-${{ env.NUMPY_VERSION }}-*-manylinux_riscv64
159161 gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }}
160162 gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }}
161163 gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }}
162- files: |
163- dist/*.whl
164+ gh-token: ${{ secrets.GITHUB_TOKEN }}
164165```
165166
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.
167+ ` permissions ` needs ` contents: write ` and ` pull-requests: write ` here (not just
168+ ` contents: read ` ) since the docs step pushes a branch and opens a PR with the
169+ default ` GITHUB_TOKEN ` .
170+
171+ Other workflows need to follow the same process, modifying ` artifact-pattern ` to
172+ match their own artifact naming scheme and otherwise reusing ` publish-wheels `
173+ like the example. The ` publish-to-gitlab ` Action should only be used directly if
174+ a workflow needs the upload step without the docs PR side effect.
169175
170176## Testing a New Workflow
171177
0 commit comments