Approaches for a sharing a theme that has a build step for typescript?

I recently changed one of my themes to use PostCSS via Hugo pipes and it worked great, but I failed to do the same with my Typescript files and I was wondering if anyone has seen any good ways for sharing themes that need a build step.

I’m currently toying with building from src in a CI/CD environment and pushing the built theme to a branch that can be tagged and used as a submodule, but it’s not working as easily as I’d hoped.

Has anyone found a good way to build and share themes that need a build step?

I’ve found one approach.

  1. Checkout the main branch
  2. Build the theme
  3. Copy the generated files to a tmp directory
  4. Checkout a “release” branch
  5. Delete any existing files
  6. Copy over the new version from the tmp directory
  7. Push that to the release branch

Then when folks want to use the theme the can use the submodules as usual (after setting the default branch to the release branch).

Example: hugo-base-theme/.github/workflows at main · gauntface/hugo-base-theme · GitHub