Skip to content

Commit a830f5d

Browse files
danielmarvAbhijeet2409
authored andcommitted
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 7aba036 commit a830f5d

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
@@ -44,5 +41,64 @@ jobs:
4441
- name: Build wheel and sdist
4542
run: python -m build
4643

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