From 1cd379138618d5fb8c90a236d126fdb79cea6ac3 Mon Sep 17 00:00:00 2001 From: Niklas Fasching Date: Tue, 28 Jul 2020 20:15:24 +0200 Subject: [PATCH] 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. --- etc/push-hugo-branch | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 etc/push-hugo-branch diff --git a/etc/push-hugo-branch b/etc/push-hugo-branch new file mode 100755 index 0000000..4616e3c --- /dev/null +++ b/etc/push-hugo-branch @@ -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