Skip to content

Commit b00c878

Browse files
committed
Merge origin/master
2 parents e60ecfa + 9f0de42 commit b00c878

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

dist/sh/publish.sh

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
BIN=$HOME
99
SHACL=$HOME/shacl
1010
DATA=/mnt/datagovbe
11+
MIN_SIZE=24500100
12+
# Git
13+
USER=$GIT_USER
14+
TOKEN=$GIT_TOKEN
15+
NAME=$GIT_NAME
16+
EMAIL=$GIT_EMAIL
17+
LOCAL=dcat.git
1118

1219
# Create directories (if not yet present)
1320
makedirs() {
@@ -114,7 +121,32 @@ compress() {
114121
# Parameter: project code
115122
publish() {
116123
step $1 "publish"
117-
status $1 "publish" $2 $?
124+
125+
F_SIZE=$(stat --format=%s $DATA/$1/datagovbe_edp.xml.gz)
126+
if [[ $F_SIZE > $MIN_SIZE ]]; then
127+
rm -rf $LOCAL
128+
129+
git clone --depth=1 https://$TOKEN@github.com/Fedict/dcat.git
130+
git config user.name "$NAME"
131+
git config user.email "$EMAIL"
132+
133+
cp $DATA/$1/datagovbe.nt.gz $LOCAL/all/datagovbe.nt.gz
134+
cp $DATA/$1/datagovbe_edp.xml.gz $LOCAL/all/datagovbe_edp.xml.gz
135+
136+
cd $LOCAL
137+
git commit -sam "Updated export"
138+
git push
139+
140+
res=$?
141+
142+
cd -
143+
rm -rf $LOCAL
144+
else
145+
echo "ERROR $F_SIZE is too small" > /mnt/logs/$1/publish.log
146+
res=-1
147+
fi
148+
149+
status $1 "publish" $2 $res
118150
}
119151

120152
# Main
@@ -123,7 +155,7 @@ publish() {
123155

124156
source=$1
125157

126-
if [ ! -d $DATA/$source ]; then
158+
if [[ ! -d $DATA/$source ]]; then
127159
makedirs $source
128160
fi
129161

@@ -132,7 +164,7 @@ scrape $source
132164
validate $source
133165
convert $source
134166

135-
if [ $? -eq 0 ]; then
167+
if [[ $? -eq 0 ]]; then
136168
compress $source
137169
publish $source
138170
fi

0 commit comments

Comments
 (0)