Build my own Deploy Previews

I’m not happy with what the build images allow me to do, unfortunately. That’s OK, it’s not the main reason I’m using Netlify, which is for the atomically deployed CDN capability, which is awesome. I know that it’s possible to manually upload a site that I’ve built separately, and that’s really cool.

Is it possible to manually upload deploy previews, or something sufficiently similar to them? They need to be separate temporary sites that are built for each pull request, but I’d like to do the actual building elsewhere. GitHub actions is where I’m currently thinking I’d like to do that. It would allow me to ensure that I have exactly the tools and versions I need to do my build.

I know that there are branch deploys, but I’m not sure that’s what I’m looking for. I’m looking for the dynamic sites nature of things, but I get the feeling from everything I read that they’re not really trying to solve the same problem. Is that a good understanding?

Sure, if you use the cli to deploy, it is by default in draft mode, which creates a browseable, stable URL like https://deploy-id-hash--sitename.netlify.com without updating your production URL.

You could alternatively use a second site for that purpose, so that you could browse it as yourtestsite.com rather than the per-deploy hash hostname.

1 Like

The deploy hash sounds pretty nice, thanks. I guess if I wanted to keep a stable URL per pull request, then I’d need to manage sites myself. That’s probably an alright thing to be doing, I was just wondering if there was a good way to hook into the existing deploy previews feature to make it a bit more seamless.

I haven’t used branch deploys yet, but I suspect that branch deploys might be similar. In my case all of our stuff is made in branches, so if I can manage branch sites through the API or something, and manually upload branch deploys, that would probably work well. Don’t know if that’s exposed.

Thanks for your insight. If you have answers to those questions, I’ll be happy to get them, but I appreciate the feedback you’ve given me already.

There is a more seamless way - let us build from git :slight_smile: But yes, deploy previews are specifically built from PR’s so you can’t make one like that yourself using the CLI. Branch deploys are the same thing - built from git based by us to be published at the stable URL.

Might be the case that our upcoming build architecture (see https://www.netlify.com/build/plugins-beta/ for some more details) would be flexible enough to allow you to use our builds - not sure, but probably worth looking into as managing more than a few such sites sounds like a pain to be avoided if possible :slight_smile: