Add helper script to simplify creating hugo pull requests

For hugo to pull in changes we need to create a pull request. Creating the
branch for that is repetitive and can be easily automated, so let's do
that. Creating the pull request itself is not as easily automated as it might
be necessary to provide a little context for the changes - so let's keep it
manual.
This commit is contained in:
Niklas Fasching 2020-07-28 20:15:24 +02:00
parent c025db7bdd
commit 1cd3791386

20
etc/push-hugo-branch Executable file
View file

@ -0,0 +1,20 @@
#!/bin/bash
# requires: push access to the hugo repo in your go path (i.e. your fork must be origin)
tag=$(git tag | tail -1)
cd ../../gohugoio/hugo
hugo_tag=$(grep github.com/niklasfasching/go-org go.sum | head -1 | awk '{print $2}')
if [[ "$tag" == "$hugo_tag" ]]; then
echo "tag $tag already exists in hugo"
exit 1
fi
git checkout -b "update-go-org-to-$tag" origin/master || git reset --hard origin/master
git pull
go get "github.com/niklasfasching/go-org@$tag" || exit 1
sed -i "\_github.com/niklasfasching/go-org ${hugo_tag}_d" go.sum
git commit -a -m "deps: Update go-org to $tag"
git push --force-with-lease