-
Notifications
You must be signed in to change notification settings - Fork 0
Release tooling: PyPI Trusted Publishing + v1.0.0 #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: release | ||
|
|
||
| # Publish to PyPI when a GitHub Release is published (the GitHub release flow). | ||
| # Uses PyPI Trusted Publishing (OIDC) — no API token is stored in the repo. | ||
| # One-time PyPI setup: add a trusted publisher for project `optimum-keysync` | ||
| # with this repo, workflow file `release.yml`, and environment `pypi`. | ||
| on: | ||
| release: | ||
| types: [published] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: release-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| pypi: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/project/optimum-keysync/ | ||
| permissions: | ||
| contents: read | ||
| id-token: write # OIDC token for Trusted Publishing; no stored secret | ||
| steps: | ||
| # Action versions pinned to commit SHAs (tag in the comment) per the | ||
| # OpenSSF / GitHub-hardening guidance used across this repo's workflows. | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| # Guard against tag/version drift: the package version (single source, | ||
| # src/optimum_keysync/__init__.py) must match the release tag (with an | ||
| # optional leading `v`), so a release never publishes a different version | ||
| # than it claims. | ||
| - name: verify tag matches package version | ||
| run: | | ||
| pkg=$(PYTHONPATH=src python -c "import optimum_keysync; print(optimum_keysync.__version__)") | ||
| tag="${GITHUB_REF_NAME#v}" | ||
| if [ "$pkg" != "$tag" ]; then | ||
| echo "::error::release tag ${GITHUB_REF_NAME} (-> ${tag}) does not match pyproject version ${pkg}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: build sdist + wheel | ||
| run: | | ||
| python -m pip install --upgrade build | ||
| python -m build | ||
|
|
||
| - name: publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -130,3 +130,16 @@ pytest | |||||||||
|
|
||||||||||
| Tests are hermetic: `respx` stubs every outbound HTTP call, so no live API or | ||||||||||
| beacon access is required. | ||||||||||
|
|
||||||||||
| ## Releasing | ||||||||||
|
|
||||||||||
| Publishing to PyPI is automated via `.github/workflows/release.yml`, which runs | ||||||||||
| when a GitHub Release is published and uploads with PyPI Trusted Publishing | ||||||||||
| (OIDC) — no token is stored in the repo. To cut a release: | ||||||||||
|
|
||||||||||
| 1. Bump `version` in `pyproject.toml` and merge to `main`. | ||||||||||
| 2. Publish a GitHub Release tagged `v<version>` (e.g. `v1.0.0`). | ||||||||||
|
Comment on lines
+140
to
+141
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Point the release docs at the real version source. Line 140 still tells maintainers to bump Suggested fix-1. Bump `version` in `pyproject.toml` and merge to `main`.
+1. Bump `src/optimum_keysync/__init__.py`'s `__version__` and merge to `main`.As per path instructions, "Prioritize technical accuracy and copy-pastable commands" and "Flag references to removed APIs, wrong paths, or steps that contradict the repo." 📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||
|
|
||||||||||
| The workflow verifies the tag matches the package version, builds the sdist and | ||||||||||
| wheel, and publishes. One-time setup: register the trusted publisher on PyPI | ||||||||||
| (project `optimum-keysync`, workflow `release.yml`, environment `pypi`). | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| """optimum-keysync: reconcile operator validator assignments against the Optimum console API.""" | ||
|
|
||
| __version__ = "0.1.0" | ||
| __version__ = "1.0.0" | ||
|
|
||
| __all__ = ["__version__"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Disable checkout credential persistence.
This job never pushes to GitHub, so keeping the checkout token in local git config only increases exposure to later steps and build hooks.
Suggested fix
As per path instructions, "Check permissions (least privilege) ... Flag secret exposure in logs, overly broad permissions" and zizmor warns "credential persistence through GitHub Actions artifacts (artipacked)."
📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.26.1)
[warning] 31-31: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false
(artipacked)
🤖 Prompt for AI Agents
Sources: Path instructions, Linters/SAST tools