shalzz / zola-deploy-action

Github action for building a Zola site and deploying to Github Pages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

keep commit history in gh-pages branch

stone-zeng opened this issue · comments

Now it uses git init and git push --force so that the gh-pages branch will be refreshed on each commit. Can we keep the commit history instead?

I was going to raise a separate issue, but I accidentally overwrote my entire website history by writing to my source branch. This is a stupid thing to do, but when people are hacking to get the zola-deploy-action working then it's something that is possible. So I think that this is very important. Important enough where I suggested that a warning be placed in the Zola docs Zola discourse: Concern about repo safety with GitHub actions deploy to prevent this from happening. Fortunately, I still had a local copy so I was able to use git push --mirror git@github.com:myname/website.git to recover.

If the history was not overwritten then this would be a non-issue as I could have obviously reverted back to the previous commit.

Cheers!

I think I said this in another similar issue, but I'll restate here.

This action mimics the behaviour of the official github pages deployment and publishing when using any of the supported SSG by github (I think it's only jekyll for now) which overwrites the history to a gh-pages branch.

In any case github actions are modular and you can mix and match the actions to achieve your desired behaviour rather than having one action that does everything.

So in order to have your own mechanism of publishing you can do so by using the action only to build the static files via the BUILD_ONLY option described here: https://github.com/shalzz/zola-deploy-action#environment-variables and publish them via any other action fit for your job.