pyratelog

personal blog
git clone git://git.pyratebeard.net/pyratelog.git
Log | Files | Refs | README

publish (1310B)


      1 #!/bin/sh
      2 
      3 # use arg as title and set entry file path
      4 # set published file path with date
      5 TITLE=$1
      6 RND=$2
      7 
      8 if [ "$RND" = "mov" ] || [ "$RND" = "lit" ] ; then
      9 	ENTRY="entry/rnd.${RND}.rec:_${TITLE}.md"
     10 	PUBLISH="entry/$(date +%Y%m%d)-rnd.${RND}.rec:_${TITLE}.md"
     11 	LINK="https://log.pyratebeard.net/entry/$(date +%Y%m%d)-rnd.${RND}.rec:_${TITLE}.html"
     12 else
     13 	ENTRY="entry/${TITLE}.md"
     14 	PUBLISH="entry/$(date +%Y%m%d)-${TITLE}.md"
     15 	LINK="https://log.pyratebeard.net/entry/$(date +%Y%m%d)-${TITLE}.html"
     16 fi
     17 
     18 # toot command path
     19 TOOT="$HOME/src/warez/toot/bin/toot"
     20 
     21 # checkout the correct branch
     22 if [ "$RND" = "mov" ] || [ "$RND" = "lit" ] ; then
     23 	git checkout -q rnd.${RND}.rec
     24 else
     25 	git branch | grep ${TITLE} && \
     26 		git checkout -q ${TITLE} || \
     27 		exit 1
     28 fi
     29 
     30 # rename entry to set date
     31 git mv "${ENTRY}" "${PUBLISH}"
     32 
     33 # commit the rename as published
     34 git commit -S -m "publish ${TITLE}"
     35 
     36 # checkout main branch and merge published entry
     37 git checkout main
     38 if [ "$RND" = "mov" ] || [ "$RND" = "lit" ] ; then
     39 	git merge rnd.${RND}.rec
     40 else
     41 	git merge "${TITLE}"
     42 fi
     43 
     44 # push new entry
     45 git push
     46 
     47 #cat <<log | $TOOT post || curl -d "log toot failed" https://pager.pyratebeard.net/logtoot
     48 #${LINK}
     49 #
     50 #${TITLE} - <description>
     51 #
     52 ##/100 #100daystooffload
     53 #
     54 ##tag #tag #tag
     55 #
     56 #rss: https://log.pyratebeard.net/rss.xml
     57 #log