44 push :
55 branches :
66 - main
7- # Only trigger when docs or config files change
87 paths :
98 - ' docs/**'
109 - ' mkdocs.yml'
1110 - ' .readthedocs.yaml'
1211 - ' docs/requirements.txt'
13- - ' .github/workflows/pages.yml' # Update this to match your actual filename
14-
15- # Allow manual trigger from Actions tab
12+ - ' .github/workflows/pages.yml'
1613 workflow_dispatch :
1714
18- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1915permissions :
2016 contents : read
2117 pages : write
2218 id-token : write
2319
24- # Allow only one concurrent deployment
2520concurrency :
2621 group : " pages"
2722 cancel-in-progress : false
@@ -32,27 +27,127 @@ jobs:
3227 steps :
3328 - name : Checkout
3429 uses : actions/checkout@v4
35-
30+
3631 - name : Setup Python
3732 uses : actions/setup-python@v5
3833 with :
3934 python-version : ' 3.11'
40-
35+
4136 - name : Cache pip dependencies
4237 uses : actions/cache@v3
4338 with :
4439 path : ~/.cache/pip
4540 key : ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
4641 restore-keys : |
4742 ${{ runner.os }}-pip-
48-
43+
4944 - name : Install MkDocs and dependencies
50- run : |
51- pip install -r docs/requirements.txt
52-
45+ run : pip install -r docs/requirements.txt
46+
5347 - name : Build MkDocs site
5448 run : mkdocs build
55-
49+
50+ # Inject wheel index AFTER mkdocs build so MkDocs can't clobber it.
51+ # Wheels are served at: https://1minds3t.github.io/omnipkg/wheels/
52+ # pip install cmd: pip install omnipkg --extra-index-url https://1minds3t.github.io/omnipkg/wheels/
53+ - name : Inject PEP 503 wheel index into site/wheels/
54+ env :
55+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56+ REPO : ${{ github.repository }}
57+ run : |
58+ python3 - <<'EOF'
59+ import os, json, urllib.request
60+
61+ repo = os.environ["REPO"]
62+ token = os.environ["GH_TOKEN"]
63+
64+ PKG_SLUG = "omnipkg"
65+ PKG_PYPI = "omnipkg"
66+ SITE_DIR = "site"
67+ INDEX_DIR = f"{SITE_DIR}/wheels"
68+
69+ def gh(url):
70+ req = urllib.request.Request(
71+ url, headers={"Authorization": f"token {token}",
72+ "Accept": "application/vnd.github+json"})
73+ try:
74+ return json.loads(urllib.request.urlopen(req).read())
75+ except Exception as e:
76+ print(f"GH API error: {e}")
77+ return None
78+
79+ def pypi_wheels(pkg):
80+ try:
81+ req = urllib.request.Request(f"https://pypi.org/pypi/{pkg}/json")
82+ data = json.loads(urllib.request.urlopen(req).read())
83+ out = []
84+ for ver, files in data["releases"].items():
85+ for f in files:
86+ if f["filename"].endswith(".whl"):
87+ out.append((ver, f["filename"], f["url"]))
88+ return out
89+ except Exception as e:
90+ print(f"PyPI fetch skipped ({e})")
91+ return []
92+
93+ gh_wheels = []
94+ page = 1
95+ while True:
96+ rels = gh(f"https://api.github.com/repos/{repo}/releases?per_page=50&page={page}")
97+ if not rels:
98+ break
99+ for rel in rels:
100+ for asset in rel.get("assets", []):
101+ if asset["name"].endswith(".whl"):
102+ gh_wheels.append((rel["tag_name"], asset["name"], asset["browser_download_url"]))
103+ if len(rels) < 50:
104+ break
105+ page += 1
106+
107+ pip_wheels = pypi_wheels(PKG_PYPI)
108+
109+ seen = {}
110+ for tag, name, url in pip_wheels:
111+ seen[name] = (tag, name, url)
112+ for tag, name, url in gh_wheels:
113+ seen[name] = (tag, name, url)
114+ all_wheels = sorted(seen.values(), key=lambda x: (x[0], x[1]))
115+
116+ os.makedirs(f"{INDEX_DIR}/{PKG_SLUG}", exist_ok=True)
117+
118+ links = "\n".join(
119+ f' <a href="{url}" data-requires-python=">=3.8">{name}</a><br>'
120+ for _, name, url in all_wheels
121+ )
122+ pkg_html = (
123+ "<!DOCTYPE html>\n<html>\n"
124+ f" <head><title>Links for {PKG_SLUG}</title></head>\n"
125+ " <body>\n"
126+ f" <h1>Links for {PKG_SLUG}</h1>\n"
127+ + links + "\n"
128+ " </body>\n</html>\n"
129+ )
130+ with open(f"{INDEX_DIR}/{PKG_SLUG}/index.html", "w") as f:
131+ f.write(pkg_html)
132+
133+ root_html = (
134+ "<!DOCTYPE html>\n<html>\n"
135+ f" <head><title>{PKG_SLUG} wheel index</title></head>\n"
136+ " <body>\n"
137+ f" <h1>{PKG_SLUG} wheel index</h1>\n"
138+ f' <p>Mainstream wheels: <a href="https://pypi.org/project/{PKG_PYPI}/">PyPI</a></p>\n'
139+ " <p>Extra platform wheels (exotic/extended) are hosted here.</p>\n"
140+ f' <pre>pip install {PKG_SLUG} --extra-index-url https://1minds3t.github.io/omnipkg/wheels/</pre>\n'
141+ f' <p><a href="{PKG_SLUG}/">Browse all {len(all_wheels)} wheels</a>'
142+ f' ({len(pip_wheels)} PyPI + {len(gh_wheels)} GH Releases)</p>\n'
143+ " </body>\n</html>\n"
144+ )
145+ with open(f"{INDEX_DIR}/index.html", "w") as f:
146+ f.write(root_html)
147+
148+ print(f"Wheel index: {len(all_wheels)} wheels -> {INDEX_DIR}/")
149+ EOF
150+
56151 - name : Upload artifact
57152 uses : actions/upload-pages-artifact@v3
58153 with :
0 commit comments