Skip to content

Commit e4e3fc1

Browse files
committed
build: harden release and publish workflows
1 parent 726fd2b commit e4e3fc1

5 files changed

Lines changed: 89 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v5
1414

15-
- uses: actions/setup-python@v5
15+
- uses: actions/setup-python@v6
1616
with:
1717
python-version: "3.12"
1818

.github/workflows/pypi-publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: id-protocol-pypi-publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
release_tag:
9+
description: Release tag to publish from
10+
required: true
11+
type: string
12+
13+
jobs:
14+
publish-pypi:
15+
runs-on: ubuntu-latest
16+
environment: pypi
17+
18+
permissions:
19+
contents: read
20+
id-token: write
21+
22+
steps:
23+
- uses: actions/checkout@v5
24+
25+
- uses: actions/setup-python@v6
26+
with:
27+
python-version: "3.12"
28+
29+
- name: Download release artifacts
30+
env:
31+
GH_TOKEN: ${{ github.token }}
32+
RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }}
33+
run: |
34+
mkdir -p dist
35+
gh release download "${RELEASE_TAG}" \
36+
--repo "${GITHUB_REPOSITORY}" \
37+
--dir dist \
38+
--pattern "*.whl" \
39+
--pattern "*.tar.gz"
40+
41+
- name: Publish to PyPI
42+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/release.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
contents: write
1414

1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717

18-
- uses: actions/setup-python@v5
18+
- uses: actions/setup-python@v6
1919
with:
2020
python-version: "3.12"
2121

@@ -32,7 +32,16 @@ jobs:
3232
run: make release-check
3333

3434
- name: Publish GitHub release
35-
uses: softprops/action-gh-release@v2
36-
with:
37-
files: |
38-
dist/*
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
run: |
38+
if gh release view "${GITHUB_REF_NAME}" --repo "${GITHUB_REPOSITORY}" >/dev/null 2>&1; then
39+
gh release upload "${GITHUB_REF_NAME}" dist/* \
40+
--repo "${GITHUB_REPOSITORY}" \
41+
--clobber
42+
else
43+
gh release create "${GITHUB_REF_NAME}" dist/* \
44+
--repo "${GITHUB_REPOSITORY}" \
45+
--title "${GITHUB_REF_NAME}" \
46+
--generate-notes
47+
fi

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Proof page:
4141
Release/install path:
4242
- `docs/RELEASES.md`
4343
- tagged GitHub release flow with `sdist`/`wheel` artifacts
44+
- PyPI publish workflow prepared for trusted publishing once package naming is finalized
4445

4546
## Choose One Path
4647

docs/RELEASES.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,42 @@ Workflow file:
7575
.github/workflows/release.yml
7676
```
7777

78+
## PyPI Publishing Flow
79+
80+
PyPI publishing is separated from GitHub release creation.
81+
82+
Workflow file:
83+
84+
```text
85+
.github/workflows/pypi-publish.yml
86+
```
87+
88+
Flow:
89+
90+
1. a GitHub release is published
91+
2. the PyPI workflow downloads the release assets
92+
3. the workflow publishes them to PyPI via trusted publishing
93+
94+
Before enabling real publication, configure:
95+
96+
1. the final package name on PyPI
97+
2. a trusted publisher for `markoblogo/ID`
98+
3. the `pypi` GitHub environment, ideally with approval protection
99+
100+
This separation is intentional:
101+
- GitHub release remains the canonical first publication step
102+
- PyPI publication stays auditable and can be approval-gated
103+
78104
## Current Release Posture
79105

80106
- installable from source via `pip install .` or built artifacts in `dist/`
81107
- lightweight wrapper CLI via `idctl`
82108
- tagged GitHub release flow for `sdist`/`wheel`
83-
- no PyPI, Homebrew, or npm publication yet
109+
- PyPI publish workflow present, pending final package-name/trusted-publisher setup
110+
- no Homebrew or npm publication yet
84111

85112
## Recommended Next Release Steps
86113

87-
1. Publish artifacts to PyPI once the package name and maintenance policy are stable.
114+
1. Finalize the PyPI package name and configure trusted publishing.
88115
2. Decide whether Homebrew or `pipx` should be a first-class install path.
89116
3. Decide whether `idctl` stays thin or grows a richer UX.

0 commit comments

Comments
 (0)