Add a GitHub Action to publish the packages to PyPI or TestPyPI - #1
Add a GitHub Action to publish the packages to PyPI or TestPyPI#1ollymaunder-dnv wants to merge 2 commits into
Conversation
| name: Build and publish packages | ||
|
|
||
| on: | ||
| workflow_dispatch: |
There was a problem hiding this comment.
Currently this is only triggered manually.
In the (near) future we can trigger it automatically. CI builds could be automatically published to Test PyPI. Tagged builds could be automatically published to the main PyPI - possibly with a manual approval step.
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v6 | ||
|
|
There was a problem hiding this comment.
Once we add some tests, we can run them as part of this workflow - and add a linting step too
There was a problem hiding this comment.
Pull request overview
Adds a manually triggered GitHub Actions workflow to build the two Python packages in this repo and publish the resulting distributions to either TestPyPI or PyPI.
Changes:
- Introduces a
workflow_dispatchworkflow with an input selectingtestpypivspypi. - Builds
dnv_windfarmer_clientanddnv_windfarmer_sdkusinguv buildand uploads theirdist/outputs as artifacts. - Downloads both artifacts in a publish job and uploads distributions using
pypa/gh-action-pypi-publishwith trusted publishing (OIDC).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…can read code and artifacts.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
.github/workflows/publish.yml:52
- As written, this workflow can be manually dispatched from any branch and will publish artifacts built from that branch. For publishing to PyPI/TestPyPI it’s typically safer to restrict publishing to the default branch (or to tags) to reduce the risk of accidentally releasing unreviewed/unintended code.
publish:
name: Publish to ${{ github.event.inputs.target }}
needs: build
runs-on: ubuntu-latest
.github/workflows/publish.yml:56
publishsets job-levelpermissionsto onlyid-token: write. Job-level permissions override the workflow-levelpermissions: contents: read, so this job no longer hascontents: readviaGITHUB_TOKEN(which can be surprising and can break steps that rely on it now or in the future). If the intent is to keep minimal permissions but still allow read-only repo access, re-addcontents: readhere explicitly.
permissions:
id-token: write # required for PyPI trusted publishing
First attempt at a GitHub Workflow to build and publish the packages