-
Notifications
You must be signed in to change notification settings - Fork 27
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
Deploy docs to gh-pages on merge #138
Conversation
* Deploy on push to master branch * Remove check on whether PR Merged since no longer needed * Separaete docs deploy into separate job that only runs if changes exist in the docs folder
|
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.
@ezmiller, this looks great to me (but I am not so experienced with gh actions and might possibly overlook something).
(If I understand the action definitions correctly, changes to docs
on the master
branch will be deployed to gh-pages
not only on PR merges, but on any push.
That is good, I think.)
I think you've understood it correctly. If you were to push directly to origin/master (which one should probably avoid) that would in fact redeploy the docs if there were changes to files within the |
Goal
This PR changes the deployment for Tablecloth's documentation. Currently, we use the Github pages feature to serve our documentation fro the
doc
folder on themaster
branch. This works fine, but we want to be able to preview documentation changes on PRs.We can do that by using an action that deploys documentation previews into a "namespaced" folder within the docs folder on the branch that we serve from. In our case, using current configuration, it would deploy previews to the
master
branch within a directory like./docs/preview/pr-100
. This is not ideal because it leads to a bunch of meaningless commits on our master branch.Instead, we can change our configuration to serve documentation from a branch called
gh-pages
. This is the default behavior that Github encourages. In this scenarios when we open a PR that includes changes to documentation, we will deploy those changes not tomaster
-- leaving that commit history clean -- and instead commit togh-pages
.Solution
To do this we need two actions: one that deploys the docs preview, and another on PR merge to
master
that deploys the official version of the documentation togh-pages
if there have been any changes to the docs. See the workflows added in the diff for this PR to see how that's done. High level summary:master
, changes to the docs folder will be deployed on thegh-pages
branch at the root. That means that we can change the Github pages setting to use thegh-pages
branch and load the index.html from the root.docs
folder, then those will be deployed to thegh-pages
branch under the directory./docs/pr-preview/pr-<pr#>
. Those preview docs will be loadable from the linkhttps://sicloj.github.io/tablecloth/pr-preview/pr-<pr#>
.Test
We can't test this fully until we change the github pages setting. However, I made a trivial change to the docs to show that the deployment of the pr-review works. See here: https://github.com/scicloj/tablecloth/tree/gh-pages/pr-preview/pr-138.