Skip to content

Commit bd98fd3

Browse files
authored
ci: add Sigstore signing and signed GitHub release artifacts for PyPI releases (hiero-ledger#2054)
Signed-off-by: Daniel Ntege <danientege785@gmail.com> Signed-off-by: Ntege Daniel <danientege785@gmail.com>
1 parent d5147d9 commit bd98fd3

2 files changed

Lines changed: 75 additions & 18 deletions

File tree

.github/workflows/publish.yml

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,10 @@ permissions:
99
contents: read
1010

1111
jobs:
12-
build-and-publish:
12+
build:
13+
name: Build distributions
1314
runs-on: hl-sdk-py-lin-md
14-
environment:
15-
name: pypi
16-
url: https://pypi.org/p/hiero-sdk-python
17-
permissions:
18-
id-token: write
15+
1916
steps:
2017
- name: Harden the runner (Audit all outbound calls)
2118
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
@@ -42,5 +39,64 @@ jobs:
4239
- name: Build wheel and sdist
4340
run: python -m build
4441

42+
- name: Upload distributions
43+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
44+
with:
45+
name: dist
46+
path: dist/*
47+
if-no-files-found: error
48+
49+
publish-and-sign:
50+
name: Publish and sign release artifacts
51+
needs: build
52+
concurrency:
53+
group: ${{ github.workflow }}-${{ github.ref }}
54+
cancel-in-progress: false
55+
runs-on: hl-sdk-py-lin-md
56+
environment:
57+
name: pypi
58+
url: https://pypi.org/p/hiero-sdk-python
59+
permissions:
60+
contents: write
61+
id-token: write
62+
63+
steps:
64+
- name: Harden the runner (Audit all outbound calls)
65+
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
66+
with:
67+
egress-policy: audit
68+
69+
- name: Download distributions
70+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
71+
with:
72+
name: dist
73+
path: dist
74+
75+
- name: Sign release distributions with Sigstore
76+
uses: sigstore/gh-action-sigstore-python@04cffa1d795717b140764e8b640de88853c92acc # v3.3.0
77+
with:
78+
inputs: |
79+
dist/*.whl
80+
dist/*.tar.gz
81+
verify: true
82+
verify-cert-identity: https://github.com/${{ github.repository }}/.github/workflows/publish.yml@refs/tags/${{ github.ref_name }}
83+
verify-oidc-issuer: https://token.actions.githubusercontent.com
84+
4585
- name: Publish to PyPI
4686
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
87+
with:
88+
skip-existing: true
89+
90+
- name: Upload signed assets to GitHub Release
91+
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
92+
with:
93+
body: |
94+
## Important notes
95+
- See https://github.com/hiero-ledger/hiero-sdk-python/milestones for the pull requests included in this milestone.
96+
- This release includes auto-generated release notes.
97+
files: |
98+
dist/*.whl
99+
dist/*.tar.gz
100+
dist/*.sigstore.json
101+
fail_on_unmatched_files: true
102+
generate_release_notes: true

RELEASE.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,23 @@ MAJOR.MINOR.PATCH
1919
1. **Update the Version**
2020
Decide whether the changes are major, minor, or patch increments.
2121

22-
2. **Update the Changelog**
23-
Move your entries from the **[Unreleased]** section in `CHANGELOG.md` to a new version heading with today’s date (e.g., `## [0.2.0] - 2025-02-20`).
24-
25-
3. **Create a Release Branch**
26-
- `release-v0.2.0` or similar (e.g., `release-v0.2.0-beta.1` for beta versions).
27-
28-
4. **Run Tests**
22+
2. **Run Tests**
2923
- Ensure all tests pass locally (run `pytest`).
3024
- Confirm CI passes (integration tests, etc.).
3125

32-
5. **Merge into `main`**
33-
- Create a Pull Request from `release-vX.X.X` into `main`.
34-
- Wait for code review, ensure everything is green.
26+
3. **Tag the Release**
27+
Once the release changes are merged, create and push a git tag that matches the publish workflow trigger (`v*.*.*`):
3528

36-
6. **Tag the Release**
37-
Once merged, create a git tag with the new version:
3829
```bash
3930
git tag -a v0.2.0 -m "Release 0.2.0"
4031
git push origin v0.2.0
32+
```
33+
34+
4. **Monitor the Publish Workflow**
35+
- The `.github/workflows/publish.yml` workflow runs automatically when the tag is pushed.
36+
- The workflow builds the source distribution and wheel, generates protobufs before packaging, signs the release artifacts with Sigstore, publishes the package to PyPI, and creates or updates the GitHub release.
37+
38+
5. **Verify Published Artifacts**
39+
- Confirm the new version is available on PyPI.
40+
- Confirm the GitHub release contains the wheel, source distribution, and matching `.sigstore.json` bundles.
41+
- If release provenance needs to be audited, use the Sigstore verification materials attached to the GitHub release.

0 commit comments

Comments
 (0)