Hi all
Just recently picked up Hugo and I’m currently working on setting up continuous integration and through Bitbucket Pipelines with continuous deployment to Github Pages.
I’ve zeroed in on this setup because it’s free and suports custom domain, so good for learning but also for very small/non-profit use cases.
I’ve had a look at these resources Host on Bitbucket, Hugo website with Bitbucket Pipelines and Continuous Deployment for Jekyll using Bitbucket Pipeline to deploy in Github to:
- Creating a Hugo environment
- Generate site
- Deploy site
And I now have the current bitbucket-pipelines.yml:
pipelines:
default:
- step:
script:
- wget https://github.com/gohugoio/hugo/releases/download/v0.30.2/hugo_0.30.2_Linux-64bit.deb
- dpkg -i hugo*.deb
- git clone https://$github_access_key@github.com/<gituser>/<reponame>.git public
- rm -r public/*
- hugo -D
- cd public
- git config --global user.email "<my email>"
- git config --global user.name "<my name>"
- git add --all
- git commit -m "update from pipelines"
- git push origin
It’s all working, but I feel the deployment part can be improved.
Currently I’m doing a git clone before I replace the content and do a git push. Is there a way to not to clone first to avoid sending a lot of assets around?
Also, I’m using Github - Personal access tokens
I would prefer using Github - Deploy keys, as that is per repo access.
Thanks for any help and hope this also can be of use for someone else trying to achieve a similar setup.
P.s. Thanks to all of you maintaining and creating Hugo, both software and community is working great! D.s.