summaryrefslogtreecommitdiffstats
path: root/ci/update_wiki.sh
blob: c3e9cfbdb1a263dd4feb26b34a2028798d7eceba (plain) (blame)
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
#!/bin/bash -f

rm -rf ci/wiki.wiki

set -e

cd ci
eval $(ssh-agent -s)
ssh-add wiki_deploy_key
git clone --depth=1 git@github.com:dexon-foundation/wiki.wiki.git

newABI=`cat ../build/contracts/Governance.json | jq -r '.abi'`

abi=false

rm -rf wiki.md
touch wiki.md

while IFE= read -r line; do
    if [[ $line == *"ABI AUTOGEN START"* ]]; then
        abi=true
        printf "<!-- [[ABI AUTOGEN START]] -->\n\`\`\`\n${newABI}\n\`\`\`\n<!-- [[ABI AUTOGEN END]] -->\n" >> wiki.md
    fi
    if [[ $abi == true && $line == *"ABI AUTOGEN END"* ]]; then
        abi=false
    fi
    if [[ $abi == false ]] ; then
    echo $line >> wiki.md
    fi
done < wiki.wiki/Governance-Contract-Interface.md

mv -f wiki.md wiki.wiki/Governance-Contract-Interface.md

cd wiki.wiki

git config user.email "TravisCI@dexon.org"
git config user.name "Travis CI"
git commit -am "Update Governance-Contract-Interface"
git push