hamelsmu / oauth-tutorial

Like GitHub Pages, but you choose who can see it without usernames & passwords.
103 stars 7 forks source link

CI with GH actions? #2

Open deven367 opened 1 year ago

deven367 commented 1 year ago

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 :)

hamelsmu commented 1 year ago

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

deven367 commented 1 year ago

Sure, I will give it a try right now. I'll let you know if I get stuck somewhere.

deven367 commented 1 year ago

@hamelsmu I think I'm done. The site is deployed successfully, but I get a 404 as it can't find the index.html

image

deven367 commented 1 year ago

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. image

hamelsmu commented 1 year ago

@hamelsmu I think I'm done. The site is deployed successfully, but I get a 404 as it can't find the index.html

image

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 ?

hamelsmu commented 1 year ago

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.

deven367 commented 1 year ago

Apologies. I had put the incorrect url in the oauth app. It's working as expected now!!

hamelsmu commented 1 year ago

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!

deven367 commented 1 year ago

Sure, I can write a small walkthrough. As an additional feature, should I try to get this to work through the gh-pages branch?

hamelsmu commented 1 year ago

If you are up to it I think it could make for a good tutorial on the nbdev docs or blog itself. @jph00 WDYT?

deven367 commented 1 year ago

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?

hamelsmu commented 1 year ago

Yeah there are different approaches:

hamelsmu commented 1 year ago

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

deven367 commented 1 year ago

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
hamelsmu commented 1 year ago

Sounds good!

deven367 commented 1 year ago

I'll write a nb for this titled nbdev with Oauth, do you want me include anything else?

hamelsmu commented 1 year ago

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!