-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add configuration for netlify deploy previews #13
Conversation
Tagging @paul121 @jgaehring and @symbioquine as reviewers for this. Not urgent - we just need two approvals to merge. I don't feel like I have enough of an understanding of the considerations here. |
Maybe it's worth spinning up a Netlify site and see if it works? Proof's in the pudding no? I nominate @mstenta to give it a try! 😜 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bumping this. Yes this LGTM. Creating another Netlify site that we never publish is a bit odd, but is certainly the easiest way to get nice netlify deploy previews for community blog!
Ah I see we need to set up another Netlify site? I haven't done that before. I think all the current Netlify stuff is set up in @jgaehring's account? @jgaehring how does it work? Does it make sense to keep them all under the same account? Or can you only have one site per account? Maybe we should set up a farmOS org and move everything into that? Scope creeping? :-P |
Any one of us can sign into Netlify via GitHub and then just give Netlify OAuth permission to read from this repo. Then, if I'm reading this correctly, the build process should start up simply from the
Eh, I don't see any reason why (see next answer).
That would be the adult thing to do, yes, and then it might make sense to have everything in one place. But last I checked, it was cost-prohibitive to have more than one seat on a given plan, and at that time I was also the only one both maintaining and deploying anything to Netlify (FK and f.o), so it seemed unnecessary, at least back then. I don't know if you can create an account as the farmOS GitHub org, or maybe just using a shared farmOS email (do I recall setting something like that up?) instead of signing in with GH, but you will have to OAuth into GH at some point to give Netlify permissions I think, soooooo..... ??? ¯_(ツ)_/¯
💯 |
Thanks for the detailed reply @jgaehring, and the link back to farmOS/farmOS.org#11 for context! We may be able to get a free Netlify Pro plan! See my comment here: farmOS/farmOS.org#11 (comment) I will investigate and report back... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone tries this out on Netlify and it works, then I say go for it and merge. It looks good to me otherwise.
Example pr on my fork with working deploy preview on Netlify: wotnak#5 |
Update: farmOS/farmOS.org#74 (comment) What do we need to do next to get this PR finished up? Do we need to create a new site in Netlify linked to this repository? |
We need now to:
After this for every new pr to the main branch in this repo deploy preview will be generated. If you want to test this before merging to the main branch, you can merge this to some other branch in this repo and setup netlify to use said branch instead of main and then create some test pr to that branch. Alternatively you can just check how it worked here wotnak#5. |
I say go for it! 🚀 |
Merged! Thanks again @wotnak! I'll set up a site in Netflify pointed at this repo now... |
OK I think I set up the Netlify site correctly, but I just tested it with a new PR (#17) and it failed. Here are the logs:
Maybe I didn't configure the Netlify site correctly? |
The branch in #17 doesn't contain the commit from this pr with the build preview configuration. If you update your branch with the changes from the current main branch it should fix the deploy preview build. |
Ah silly me! 😅 That worked! Thanks @wotnak! |
This pr adds configuration needed to setup deploy previews for pull requests in this repo.
Netlify sites are very coupled to the specific repo and its branches, so the easiest way to configure deploy previews is to setup this repo as a netlify site. To this end I created a build configuration that temporarily copies the main site repo and using repo/branch overrides builds the site with the blog source replaced with the pr repo/branch. Netlify doesn't have an existing env var for pr source repo, so to get it's url I created a small script that queries github api for pr details. I also added netlify configuration to set http header telling search engines to don't index this repo's site.
After merging this, netlify site for this repo will need to be created. Just creating a site without changing any defaults should be enough, any additional required netlify configuration is handled using the
netlify.toml
file.