-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-day-update-to-blog.sh
executable file
·50 lines (43 loc) · 1.95 KB
/
post-day-update-to-blog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -e
set -o pipefail
cd "$(dirname "$0")"
IMG="![ᏣᎳᎩ-ᏧᎴᎯᏌᏅᎯ-ᎤᏍᏛᎪᏍᏙᏗ.png](https://cdn.steemitimages.com/DQmbrTUET1HhhfPDDVSqaDzXB6m9Xicrq1qRBYB2DHWb6Pw/%E1%8F%A3%E1%8E%B3%E1%8E%A9-%E1%8F%A7%E1%8E%B4%E1%8E%AF%E1%8F%8C%E1%8F%85%E1%8E%AF-%E1%8E%A4%E1%8F%8D%E1%8F%9B%E1%8E%AA%E1%8F%8D%E1%8F%99%E1%8F%97.png)"
when=$(git log -1 --pretty=format:'%ci')
mkdir tmp 2> /dev/null || true
touch tmp/log.old
git log --branches=\* --after="1 week ago" > tmp/log.new
diff tmp/log.new tmp/log.old > /dev/null 2>&1 && exit
if [ ! -s tmp/log.new ]; then exit; fi
echo "Posting new message"
msgfile="tmp/msg.txt"
cp /dev/null "$msgfile"
echo "title: Updates for $(basename $(pwd)) within the past day. [$when]" >> "$msgfile"
echo "tags: utopian-io steemdev java gwt steem-js" >> "$msgfile"
echo "format: markdown" >> "$msgfile"
echo "" >> "$msgfile"
echo "ᎯᎠ ᏗᏣᎳᎩ ᏗᎪᏪᎶᏗ ᏧᏩᏛᏍᏙᏗ ᏗᎾᏕᏠᏆᏍᎩ ᏧᏂᎪᎵᏰᏗ." >> "$msgfile"
echo "" >> "$msgfile"
echo "This tool is to find Cherokee language articles and PDFs for use by students of the Cherokee language." >> "$msgfile"
echo "" >> "$msgfile"
echo "GITHUB: https://github.com/CherokeeLanguage/Scraper-CherokeePhoenix" >> "$msgfile"
echo "" >> "$msgfile"
echo "${IMG}" >> "$msgfile"
echo "" >> "$msgfile"
echo "## $(basename $(pwd))" >> "$msgfile"
echo "Updates for $(basename $(pwd)) in the past day. $when" >> "$msgfile"
echo "" >> "$msgfile"
echo "" >> "$msgfile"
git log --branches=\* --after="1 day ago" | sed 's/<.*@.*>/[email redacted]/g' | sed 's/^commit /#### commit /g' >> "$msgfile"
echo "" >> "$msgfile"
echo "" >> "$msgfile"
sed -i 's/\&/\&/g' "$msgfile"
sed -i 's/</\</g' "$msgfile"
sed -i 's/>/\>/g' "$msgfile"
sed -i 's/\t/ /g' "$msgfile"
sed -i 's| |\ |g' "$msgfile"
java -jar ~/git/SteemCliPoster/build/libs/SteemCliPoster.jar \
--auth-file ~/.steem/magali.properties \
--no-escape \
--file "$msgfile"
cp tmp/log.new tmp/log.old