oauth-tutorial
oauth-tutorial copied to clipboard
CI with GH actions?
hey @hamelsmu, thanks for this great tutorial. I was thinking is there a way to use this same principle to deploy private nbdev docs? Also, use GH actions alongside so that it allows CI?
If possible, I'll try to help :)
Yes I think it's pretty straight forward, nbdev generates the static site in the same way quarto does with a _docs/ folder after you run nbdev_docs
So if you took this tutorial I think you have everything you need to make it happen! Let me know if you have any questions - we would love for someone to write a nbdev specific tutorial and wire it up with CI - do you want to take a crack at it? I can help if you get stuck!
cc: @jph00 @seem
Sure, I will give it a try right now. I'll let you know if I get stuck somewhere.
@hamelsmu I think I'm done. The site is deployed successfully, but I get a 404 as it can't find the index.html

Here is the repo, https://github.com/deven367/nbdev-oauth
Also, for the deployment to go through, I had to push the _docs folder to the master branch as well. I wanted the deployment to work off of the gh-pages branch, but that needs the render.yml, dockerfile and the email_list files on the gh-pages branch.
The current workflow has been set to create an orphan branch to publish the site. If we set force_orphan to false, I think the whole deployment could work through the gh-pages branch directly.

@hamelsmu I think I'm done. The site is deployed successfully, but I get a 404 as it can't find the
index.html
Hi Deven you are showing me a GitHub pages error, but that doesn't make any sense since you should be deploying your site through Render. Am I missing something ?
Also if you deploy your site through a Render blueprint there is no need for GitHub Actions. It will monitor your repo for changes and rebuild.
Apologies. I had put the incorrect url in the oauth app. It's working as expected now!!
Excellent! Do you mind writing a tutorial and/or do a quick video to show other people how to do the same? I think it might be really valuable!
Sure, I can write a small walkthrough. As an additional feature, should I try to get this to work through the gh-pages branch?
If you are up to it I think it could make for a good tutorial on the nbdev docs or blog itself. @jph00 WDYT?
I think the gh-pages branch would be better, as in the current approach we also need to push the _docs with each change, unless we could do that directly in docker?
Yeah there are different approaches:
- build the site in Docker too (you would have to have all the nbdev dependencies). This might be the cleanest.
- render.yaml allows you to target a different branch https://render.com/docs/blueprint-spec, if you want to do the branch approach, but then you need GH Actions
Deven this file might help you if you are trying to build the dependencies https://github.com/fastai/workflows/blob/master/quarto-ghp/action.yml
Yeah, I think I figured it out. With minimal change, it is working directly with the gh-pages branch. The new workflow requires minimal change, you just need to push the 3 files to the gh-pages braches and modify the workflow slightly.
Here is my modified workflow
name: Deploy to GitHub Pages
permissions:
contents: write
pages: write
on:
push:
branches: [ "main", "master" ]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: deven367/workflows/quarto-ghp@master
with:
orphan: false
keep_files: true
Sounds good!
I'll write a nb for this titled nbdev with Oauth, do you want me include anything else?
My only suggestion if you are going to do a PR against nbdev with a new tutorial is to make it as generalizable as possible so that people are aware they don't have to use Render. You can accomplish this by linking to this OAuth tutorial if you like where I mention different alternatives (but feel free to accomplish this another way if you have a good idea)
Thanks in advance for your help!