Custom build command for home-grown CMS?

I have a homegrown CMS sort of like Hugo or VuePress, written in Go. It consists of an executable with some config files.Is there a way to create a custom build command so that I run it instead of Hugo or Jekyll or whatever to generate the site? Have spelunked through the docs extensively but my guess is I don’t know the name of what I’m searching for.

I’m imagining I would deliver this to Netlify as Go source and/or executable in a Docker image or something, but I’m a little unclear on the process.

I’m not sure what you mean but if you are referring to the build command that our buildbot will use when a deploy is triggered, you can set that in your site’s deploy settings. Is that what you were looking for?

Thanks, Dennis! So the Build Command they have in that example is Jekyll. If I’ve written a generator named foo, how do you guys get the copy of foo so that it runs instead of Jekyll?

You’d have to install it. Jekyll gets installed by your Gemfile which we automagically process using bundler; some other things (e.g. Gatsby) get installed by package.json or yarn.lock (using npm or yarn).

So - a good first starting spot is to wrap up your generator in an npm or ruby package that you can install as bundle install foo or npm install foo (those names are probably taken so you’ll need to be a bit more creative due to single global namespace) and then you can require them via those package managers’ config files, let us install automatically, and then we’ll be able to run your build command of foo :slight_smile:

Thank you, ah, fool. Boy I feel weird calling you that. Anyway, I just want to use a compiled Go executable so from what I can tell, I’d just put its name in the “bin” field of what will turn out to be a pretty small package.json file, right? Sorry, I’m not an NPM person.

Or, you can just have your compiled Go executable in your repository. You can call the binary from the there.

OH!!!

Too easy! Thanks and I’ll leave you alone now!

awesome, glad we had some solutions for you. Come back anytime. !

If you are using Go, you can also have Netlify compile and run your Go source files for you. Just make a simple script like “build.sh” and set you build step to run it. The script can be something like this one: netlify-go-function-demo/build.sh at master · carlmjohnson/netlify-go-function-demo · GitHub. That one just compiles the Go files into the functions folder for use with Netlify Functions, but you could add another step to run your command once it has compiled.

Carl, that script is awesome, and so brief! Thank you!