I'm making a webapp that does version control of files using git and it has the option of being hosted on GitHub Pages with some missing features (features not supported by a git-only backend).
Now the "app" itself is separated from the users content, the user content is version controlled but the app is not (or at least doesn't need to be for the functionality of the app itself), but both need to be uploaded to github pages and to isolate the content's version control, and to have different permissions for the app vs content, I host the app itself in gh-pages and the content as a git submodule inside the gh-pages repo.
This works, the app/site is built and gets exposed on username.github.io/sitename/
with everything accessible, except there is a catch.
The catch is that for some reason the submodule content repo is referred to at a specific commit instead of just the latest version of the repo, which means I can't just update the content repo and have everything work but also have to update the app repo to refer to the latest version of the submodule, on every content repo commit.
Which gets a bit tedious since I almost never actually have to update the app repo unless there is a new version of the app but I update the content repo daily, as well as the fact that the content repo should be editable by many people but the app repo by few.
So my question is:
- How can I define a submodule to always refer to the latest commit of a repo?
- How can I trigger a build of the site by only updating the submodule repo?
- How can the gh-pages repo always reflect the latest version of its submodules, so that the gh-pages site is always serving the latest content?
- Example repos:
- Git Submodules:
How I create the submodule
# Create app master + app-content master, then:
git init
git remote add origin https://github.com/01AutoMonkey/app.git
git submodule add https://github.com/01AutoMonkey/app-content ./wiki
cd wiki
git remote add origin https://github.com/01AutoMonkey/app-content.git
# And then push to both repos and create a gh-pages branch.
# The site is now running but if I update app-content the update isn't reflected on the site until I refer to the new commit in the app repo.