commit ce6a51f01a67eaf021edde95758d13a66de98f21 parent 0058246aef6b23f215bf8465f2d1cbc997035f47 Author: pyratebeard <root@pyratebeard.net> Date: Sun, 6 Nov 2022 10:29:28 +0000 manage rnd.{mov,lit}.rec entries Diffstat:
M | scripts/publish | | | 30 | +++++++++++++++++++++++------- |
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/scripts/publish b/scripts/publish @@ -3,17 +3,29 @@ # use arg as title and set post file path # set published file path with date TITLE=$1 -POST="entry/${TITLE}.md" -PUBLISH="entry/$(date +%Y%m%d)-${TITLE}.md" -LINK="https://log.pyratebeard.net/entry/$(date +%Y%m%d)-${TITLE}.html" +RND=$2 + +if [ "$RND" = "mov" ] || [ "$RND" = "lit" ] ; then + POST="entry/rnd.${RND}.rec:_${TITLE}.md" + PUBLISH="entry/$(date +%Y%m%d)-rnd.${RND}.rec:_${TITLE}.md" + LINK="https://log.pyratebeard.net/entry/$(date +%Y%m%d)-rnd.${RND}.rec:_${TITLE}.html" +else + POST="entry/${TITLE}.md" + PUBLISH="entry/$(date +%Y%m%d)-${TITLE}.md" + LINK="https://log.pyratebeard.net/entry/$(date +%Y%m%d)-${TITLE}.html" +fi # toot command path TOOT="$HOME/src/warez/toot/bin/toot" # checkout the correct branch -git branch | grep ${TITLE} && \ - git checkout ${TITLE} || \ - git checkout -b ${TITLE} +if [ "$RND" = "mov" ] || [ "$RND" = "lit" ] ; then + git checkout -q rnd.${RND}.rec +else + git branch | grep ${TITLE} && \ + git checkout -q ${TITLE} || \ + exit 1 +fi # rename post to set date git mv "${POST}" "${PUBLISH}" @@ -23,7 +35,11 @@ git commit -S -m "publish ${TITLE}" # checkout main branch and merge published post git checkout main -git merge "${TITLE}" +if [ "$RND" = "mov" ] || [ "$RND" = "lit" ] ; then + git merge rnd.${RND}.rec +else + git merge "${TITLE}" +fi # push new post git push