Deploy: netlify not triggering from github static HTML page subdirectory

This is about continuous deploying an RMarkdown website, but not a blogdown site.

The problem I have is that the site builds inside my RStudio client (in this case, the HTML-site is stored in the _site subdirectory) I can push that to my GitHub remote. I have set Netlify to deploy from that directory. But, the site is already built. Netlify does not seem to get triggered by GitHub, after the push – but will deploy if I manually trigger at netlify. or manually drag the _site folder to netlify.

Some detail:

I have a github repo that uses RStudio to build a site. The build command is an R function, part of the rmarkdown package: rmarkdown::render_site(encoding = 'UTF-8') That function renders/builds HTML/CSS in the _site sibdirectory. Since this is not a blogdown site, it doesn’t use hugo to build the site.

  1. I’m not sure what to put in the build command for Netlify deployment.

    • But do I have to build at Netlify? Can I have netlify trigger from new files in _site subdirectory of the GitHub repo?
  2. I have set the netlify publish directory to _site

Is there some other way or additional settings to get Netlify to trigger by the changes in the GitHub/repo/_site directory? I’ve looked through several pieces of documentation (1 2, these support message, more). So far, what I am seeing documented addresses blogdown/hugo. Sorry if I’m missing something, but I would be grateful for any help.

deploy log from dragging files or manually triggering a deploy:

hmm, interesting. What you are doing should work - this seems like something build settings related, given that you are pre-building the site.

Some clarifying questions:

  • after you have completed building, are you manually adding, committing, and pushing those built html files to github?
  • can you post a screenshot of your build settings please?

Yes to the first question. That is, I am manually building the site by running the render_site() function locally in RStudio. Then: staging, commiting and pushing the entire local repo to GitHub. The built site is in _site, a subdirectory of the git repository (and found in the GitHub remote.)

Here are the building settings

Thanks for looking.

hmm. would you try leaving the publish directory blank, and instead, setting the _site as the base dir?

another thing to maybe check are the deploy contexts. You are deploying from master? if yes, then the branch should be set to master, for example.

Bummer, that didn’t work. I can still trigger the deploy so the urgency is not critical.

Here’s what I tried this time.

  1. change build settings per your suggestion

I noticed, here, that the Publish directory value got filled in automatically and relattive to the Base directory value. Either way, it didn’t change the trigger deployment.

  1. I checked the Deploy context to make sure it’s deploying from master. It is.

see next reply for image

  1. I tried the setting under Trigger deploy > Clear cache and deploy site.

That didn’t affect the auto deploy, but the site still builds either way.

I appreciate all your suggestions @perry. I guess I’m doing everything correct. I would love to fix this, but I can totally live with it as is. If you have time, and think of anything else, let me know. Otherwise, I guess it’s just a weirdness.

Best.

Deploy context

Jumping into this after quite a bit of conversation, so wanna make sure I understand the issue: drag-and-drop deploy works AND manually triggering a deploy works. We’re looking for a way to deploy on Netlify more efficiently, without building first, since your RStudio client does the build itself and outputs a site?

If I got that right, I think you’re looking for a manual deploy via the Netlify CLI. Here’s a good description from @luke of what the CLI does:

The netlify deploy command is doing a manual deploy (a deploy without a build). This is the CLI equivalent of a “Drag & Drop ” deploy done in the web UI.

For both netlify deploy and “Drag & Drop”, the files of the site are deployed “as is”. There is no build process with either method.

If using this command, the build should occur locally and then the command is used to manually deploy the files which were built there.

And our docs on that are here:

Do you wanna give this method a shot and let us know how it goes?

Well that didn’t work. I spent the last 1.5 hours trying out the suggestion: using the netlify CLI. I really wanted that to be a good solution for me and I wanted to try it; I thought I could give back a bit of effort and tried to be helpful – since Netlify helps me by freemium hosting some of my sites. But that solution just didn’t work – like almost none of it: The node.js install was a pain, the netlify cli didn’t work very well. the command argument itself didn’t actually finish cleanly and had to be CTRL-C (*2) or CTRL-D just to get back to the prompt. I did a lot of reboots to test this. It’s a thumbs down for me.

In fact this whole nodejs install has caused some problems on my local workstation – which is a pretty new machine (about 3 months old). I guessing I’m going to spend some time over the next week(s) backing out of nodejs. To be honest I will probably not ever try this solution again. But I did take a lot of notes if you want to chat about how horrible my experience was.

For me, bottom line it, I do not think that solution should be recommended for small site deploys – at least not without a lot more developer testing. (Just not a good experience.) In the end all the CLI allowed me to do was use a buggy program to manually trigger a deployment from the command line. When, actually for me, triggering a manual deploy from the netlify website UI is not that onerous. Based on all the time I just invested in trying this out I would also say, the web site manual trigger is far more efficient by a factor of well past 50. A small site user like myself should probably not try the CLI solution. Anyway, my impression is that I’m not the proper use-case of that CLI tool.

Just to be clear, what I think I was trying to do is not the problem being solved by the CLI. I should have clarified my problem again. Meanwhile, I just want to pass on the feedback: my attempt with the CLI gave me the impression the CLI is under-cooked. I am concerned others might have a similar experience.

Back to my clarification: What I was trying to get accomplished was auto triggering from GitHub – after building a site on my LFS and pushing to github. I know, in the past, that functionality has worked for me. I know I have other netlify hosted sites that did that in the past. I hope the auto publishing is still working for those sites (not motivated to test that right now. And, maybe that functionality has been removed in favor of this CLI?) But I’d rather not mess with that CLI tool again. Manual triggering, though not my preference, through the Netlify website UI is vastly more efficient than all the time I just spent installing and troubleshooting the CLI – for what amounted to be rather buggy experience that didn’t result in an auto publish trigger following a git push.

Ugh, sorry to hear about that frustrating Node.js experience! I wish I had some good advice around it, but that’s a bit outside of our wheelhouse. What we can still help with is getting the GitHub build to auto-trigger a commit; I believe we can get this working in short order now that we’ve tried some other things :slight_smile:

I see this repository was linked to our service a very long time ago - in 2018. Back then, the linkage intended to create 2 things:

  1. a deploy key that we can use to pull your source code. This clearly works, since you can push the “trigger deploy” button and we get your code. So, good start!
  2. a webhook, that notifies us when you commit. We then follow the settings in your deploy & build settings card that you showed in an earlier screenshot, here: https://app.netlify.com/sites/ggplot-rfun/settings/deploys#deploy-contexts and that looks correct. We’d filter out non-master commits, but I can see from your repo history that you have many master commits, so I think we are simply not being told or not getting the notifications.

Could you check your webhook settings in GitHub’s UI, here? https://github.com/libjohn/ggplot-intro/settings/hooks

There should be a single hook, looking like this:

Assuming that is there, could you hit that “Edit” button and look at the VERY bottom of the resulting page at the transmission history? That should tell us a bit more about what GitHub has been telling us - and what we’ve been saying in response.

Thanks again for your help in troubleshooting!

1 Like

Thanks @fool. That did it.

My Netlify site is now set so that my site will deploy via auto-publish following a git push to GitHub repo:

  1. Add a Build hook at Netlify site:
  • Netlify > <<choose your site>> > Settings > Build & deploy > Build hooks > Add build hook
  1. Paste Build hook into GitHub Webooks settings:
  • GitHub > <<your repo>> Settings > Webhooks > Add webhook >
    <<paste the netlify build hook URL>>

Many thanks for all the help, Netlify Community!!

2 Likes

you are welcome. I’m glad we were able to make things better!!

1 Like