Deploy previews on long-running PRs

The deploy previews feature looks great and I’d love to integrate it into a repo hosted on GitHub. However, the build to generate the HTML for the docs for that repo is quite long (30 minutes on our current CI machines) and intensive since it relies on the full project to be built first. Given that is the case, how can I utilize deploy previews? It seems like hosting the build on Netlify via the build command that netlify init asks for isn’t tenable. The build (including the docs build) already happens on our own CI machines. Is it possible for PRs to manually upload the raw HTML (which may only be generated 30 minutes after the PR is pushed to) and still have it be a “deploy preview”?

(ps: I tried netlify deploy manually on the built HTML and it works fine, but the missing piece is that this isn’t associated with a PR at all and doesn’t have the review features of a deploy preview)

HI @driazati,

Welcome to the Netlify forums

Under Site Settings > Build & Deploy > Continuous Deployment you can Stop builds in which

Netlify will never build your site. You can build locally via the CLI and then publish new deploys manually via the CLI or the API.

You can then Deploy via API.

This may possibly suit your needs.

That would certainly get a deploy up and running for viewing, but it seems like that would miss some of the review-focused features for deploy previews (i.e. the stuff from this post), so I guess my real question is: can I manually link a deploy with a GitHub Pull Request in order to get the review tools?

Excellent question, which unfortunately I cannot answer.

Perhaps @hillary or @perry can assist in finding an answer for you.

1 Like

Hi, @driazati. The only way to use the deploy preview workflows at Netlify is to build the site at Netlify. Note, using the --alias option with netlify deploy does not create branch deploys.

The --alias option is intended to be used as a single use identifier. Using that option repeated with the same string does not create branch deploys. There is a feature request for the CLI deploys to be able to function as branch deploys.

It sounds like you have a similar but slightly different request. It sounds like the requirement you have is for there to be a way to link a manual deploy using netlify deploy to a PR at GitHub. Is that correct?

If so, we can file a feature request to this but it isn’t possible at this time.

If there are other questions or if we should file that feature request, please let us know.

1 Like