bcgov / ds-intro-to-python

Lessons for an Introduction to Data Science using Python Workshop
https://bcgov.github.io/ds-intro-to-python/
Creative Commons Attribution 4.0 International
3 stars 1 forks source link

Render pages on push to main? #13

Closed ateucher closed 1 year ago

ateucher commented 1 year ago

@swayneh @lindsay-forestell should we set up a GitHub Actions workflow that renders the course site to GitHub pages whenever there is a push to main or a PR is merged?

If so, then after all open PRs are merged, I think it's sensible to remove the rendered materials from the repo, and add the _book folder to .gitignore. Then you can render/preview locally but will only be pushing up changes to the source material, which will make version control much easier.

lindsay-fredrick commented 1 year ago

That's a great idea. I've always struggled with the workflow required to remove something from a repo once you've added it, so walking through that would be helpful. (Is it as simple as deleting the folder, pushing that to main, then adding it to .gitignore before rendering locally again?)

ateucher commented 1 year ago

Not quite that simple unfortunately (it never is with Git!). I think the workflow is:

Once all PRs are merged, ne person pulls main and:

  1. Add course-content/_book/ to .gitignore
  2. run git rm -r --cached course-content/_book
  3. Push

When everyone else pulls main it will delete the _book dir from their repo, which is ok because then we should be able to render/preview locally, which will recreate the _book dir, but not track it in git anymore

lindsay-fredrick commented 1 year ago

Okay that's not so terrible, we can do that piece for sure. Is there anything we need to change to set up the GitHub Action to render to GitHub pages?

ateucher commented 1 year ago

So maybe before creating new content let's try to get to a pretty clean state on main by finishing up and merging the two open PRs... I think that's the easiest path now since we didn't set it up properly to start.

ateucher commented 1 year ago

For the Actions piece, we should just be able to add the appropriate yaml file from here: https://github.com/quarto-dev/quarto-actions

lindsay-fredrick commented 1 year ago

Okay great. Once our current PRs are done we will try to set that all up :)

ateucher commented 1 year ago

Actually another possible route that would make the current PRs cleaner - do the above on main, then locally switch to each branch and git merge main and then push. That will clean out the _book dir on each PR

lindsay-fredrick commented 1 year ago

Okay I've updated main to have a modified gitignore and removed the _book folder from the repo. I've also updated all my local branch repos to be merged with main so that this change is propagated everywhere - I'm guessing both of you will need to do the same @ateucher @swayneh ?

lindsay-fredrick commented 1 year ago

Website is updated, _book is gone, and we are good to go! Going to close this off.

ateucher commented 1 year ago

Nice work @lindsay-forestell!