Skip to content

ci: build wheel with compiled frontend and attach to release#2

Merged
sandaljain merged 1 commit into
masterfrom
ci/release-wheel-with-frontend
Jul 13, 2026
Merged

ci: build wheel with compiled frontend and attach to release#2
sandaljain merged 1 commit into
masterfrom
ci/release-wheel-with-frontend

Conversation

@sandaljain

Copy link
Copy Markdown
Collaborator

Problem

The admin site serves SQL Explorer's frontend from /static/explorer/*
(e.g. main.5.3.js, styles.css, bootstrap-icons.woff2, logo-main.svg).
In production every one of these 404s.

Root cause

This package is consumed by git rev (django-sql-explorer @ git+…@5.3.0-scrub-hook).
Explorer 5.x has a Vite-built frontend whose compiled output lands in
explorer/static/explorer/ — which is gitignored (it's a build artifact).
A git-rev install runs the Python build backend only; it never runs npm run build.
So the installed package contains just explorer/src/ (un-built source), collectstatic
finds nothing under explorer/, and nginx returns 404 for every asset.

The packaging is already correct — MANIFEST.in (recursive-include explorer *) +
include_package_data=True bundle the built static into the wheel. The only missing
piece is that the frontend must be built before the package is built, which a git-rev
install skips.

Fix

Add release-wheel.yml: on a published GitHub Release, set up Node from .nvmrc,
npm cinpm run buildpython -m build, then attach the wheel (+ sdist) as a
release asset. Consumers install that wheel directly, so the built static ships inside
the package and no Node/Vite toolchain is needed at install or deploy time.

Guards included (this build has a silent-failure mode):

  • if APP_VERSION is empty the Vite build emits main..js and still exits 0 — the
    workflow now fails if main.<version>.js is absent.
  • the workflow fails if the wheel doesn't contain the built static.

Also removes publish-pypi.yml: it published to the upstream public PyPI project
on every release — wrong for this fork, and it would otherwise fire on the same
release: published event this workflow relies on.

Verification (built locally from this branch's code)

wheel: django_sql_explorer-5.3-py3-none-any.whl
explorer/static/explorer/main.5.3.js           86 KB
explorer/static/explorer/styles.css           316 KB
explorer/static/explorer/bootstrap-icons.woff2 131 KB
explorer/static/explorer/bootstrap-icons.woff  176 KB
explorer/static/explorer/images/logo-main.svg  86 KB
… 17 static entries total

After merge

  1. Cut a GitHub Release on tag 5.3.0-scrub-hook → this workflow builds the wheel on the
    pinned Node 20 and attaches it.
  2. Repoint voicebot-engine from the git-rev pin to the release-asset wheel URL (separate PR).

🤖 Generated with Claude Code

Installing this fork by git rev never runs the Vite build, so the
compiled frontend (explorer/static/) is absent from the installed
package and every /static/explorer/* asset 404s in production.

Add a release-triggered workflow that builds the frontend and a wheel,
then attaches the wheel (+ sdist) as a release asset. Consumers install
the release-asset wheel, so built static ships inside the package and no
Node/Vite toolchain is needed at install or deploy time. The workflow
fails loudly if APP_VERSION is empty (which silently produces main..js)
or if the wheel lacks the built static.

Remove publish-pypi.yml: it published to the upstream public PyPI
project on every release, which is wrong for this fork and would also
fire on the releases this new workflow depends on.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@sandaljain sandaljain merged commit 5c1d8e3 into master Jul 13, 2026
5 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant