Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/peaceiris/hugo-theme-iris.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeaceiris <30958501+peaceiris@users.noreply.github.com>2021-06-27 04:32:46 +0300
committerpeaceiris <30958501+peaceiris@users.noreply.github.com>2021-06-27 04:32:46 +0300
commitec1c7e6df2defc3beaa72b2d69f6d30337587216 (patch)
tree8ed964a66164a4f9c0663f55f79140583282693c /scripts
parent7a501fae67b7152160a1216e65eb690b04f351ac (diff)
ci: create pr with gh
Diffstat (limited to 'scripts')
-rw-r--r--scripts/bump_hugo.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/bump_hugo.sh b/scripts/bump_hugo.sh
index f60fb8e6..7777cb77 100644
--- a/scripts/bump_hugo.sh
+++ b/scripts/bump_hugo.sh
@@ -3,10 +3,22 @@
# fail on unset variables and command errors
set -eu -o pipefail # -x: is for debugging
+export DEFAULT_BRANCH="main"
+export CURRENT_BRANCH="$(git branch --show-current)"
+
+if [ "${CURRENT_BRANCH}" != "${DEFAULT_BRANCH}" ]; then
+ echo "$0: Current branch ${CURRENT_BRANCH} is not ${DEFAULT_BRANCH}"
+ exit 1
+fi
+
+git pull origin "${DEFAULT_BRANCH}"
export TARGET_FILES=".env theme.toml"
export HUGO_VERSION_LATEST=$(curl -s "https://api.github.com/repos/gohugoio/hugo/releases/latest" | jq -r '.tag_name')
export HUGO_VERSION_CURRENT=$(. ./.env && echo ${HUGO_VERSION})
echo "bump hugo from ${HUGO_VERSION_CURRENT} to ${HUGO_VERSION_LATEST#v}"
+git checkout -b "hugo-${HUGO_VERSION_LATEST#v}"
sed -i "s/${HUGO_VERSION_CURRENT}/${HUGO_VERSION_LATEST#v}/g" ${TARGET_FILES}
git add ${TARGET_FILES}
git commit -m "deps: bump hugo from ${HUGO_VERSION_CURRENT} to ${HUGO_VERSION_LATEST#v}"
+git push origin "hugo-${HUGO_VERSION_LATEST#v}"
+gh pr create --web