-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
97 lines (84 loc) · 2.69 KB
/
publish.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#
# vim: nospell
#set -e
symb=jscript
if ! ipfs key list | grep -q -w $symb; then
key=$(ipfs key gen -t rsa -s 3072 $symb)
else
key=$(ipfs key list -l | grep -w $symb | cut -d' ' -f 1)
fi
echo key: $key;
gitid=$(git rev-parse --short HEAD)
if false; then
# synchronize w/ local files !
# master :
rsync -aub $HOME/HDD/websites/tommy/repositories/helio/js/*.js $HOME/GITrepo/iglake/cssjs/js/src/
rsync -aub $WWW/js/*.js $HOME/GITrepo/iglake/cssjs/js/src/
# sync back ...
rsync -Caub $HOME/GITrepo/iglake/cssjs/js/src/*.js $WWW/js/
fi
# no examples is in dist !
qm=$(ipfs add -Q -r -w src/*.js README.md qm.log --cid-base=base58btc)
#qm=$(ipfs add -Q -r -w src/*.js README.md examples qm.log)
tic=$(date +%s)
echo $tic: $qm >> qm.log
echo " - $qm" >> mutable.yml
tail -1 qm.log
echo http://127.0.0.1:8080/ipfs/$qm
ver=$(version -a README.md | xyml scheduled)
echo $ver > VERSION
rm -rf dist/*
find . -name "*.*~*" -delete
ipfs get -o dist /ipfs/$qm
if ! ipfs files stat /root/www --hash 1>/dev/null; then
ipfs files mkdir -p /root/www
ipfs files chcid --cid-version 0 /root/www
else
ipfs files rm -r /root/www/js
fi
ipfs files cp /ipfs/$qm /root/www/js
echo -n "www: "
www=$(ipfs files stat /root/www --hash)
if [ "x$www" != 'x' ]; then
ww32=$(ipfs cid base32 $www)
ww36=$(ipfs cid format -f=%m -b=base36 $www)
echo http://$ww36.ipfs.dweb.link/js
echo url: https://gateway.ipfs.io/ipfs/$www/js
echo "info: /ipfs/$www/js"
echo ipns: http://127.0.0.1:8080/ipns/$key
ipfs name publish --allow-offline --key=$symb /ipfs/$www/js &
echo -n "rootkey: "
rootkey=$(ipfs files stat /root --hash)
echo https://gateway.ipfs.io/ipfs/$rootkey/www/js
echo cf: https://$ww32.cf-ipfs.com/js
echo cdn: https://cdn.jsdelivr.net/gh/mychelium/js@master/dist/inc.min.js
# update README ...
cat README.txt | sed -e "s/\$ver/$ver/g" -e "s/\$gitid/$gitid/g" \
-e "s/\$qm/$qm/g" -e "s/\$rootkey/$rootkey/" -e "s/\$www/$www/" > README.md
else
echo no /www
fi
git add --all
git reset src dist/examples dist/qm.log
git status
date=$(date +%D);
msg="$(echo -e '/### Last fix/+2,$p' | ed README.txt)";
if git commit -m "$ver: $msg on $date"; then
gitid=$(git rev-parse HEAD)
git tag -f -a $ver -m "tagging $gitid on $date"
#echo gitid: ${gitid:0:9} # this is bash!
echo gitid: $gitid | cut -b 1-14
echo $tic: $gitid >> revs.log
#cho -e "1\n/### Last fix/+2,\$ d\nwq" | ed README.txt
echo -e "$\n?Last fix?+2,$ d\nwq" | ed README.txt
# test if tag $ver exist ...
if git ls-remote --tags | grep "$ver"; then
git push --delete origin "$ver"
fi
fi
echo "git push : "
git push --follow-tags
echo .
echo url: https://github.com/mychelium/js/releases/
echo url: https://cdn.jsdelivr.net/gh/mychelium/js@master/
echo url: https://www.jsdelivr.com/package/gh/mychelium/js/