Skip to content

Commit

Permalink
Merge origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
barthanssens committed Sep 26, 2024
2 parents e60ecfa + 9f0de42 commit b00c878
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions dist/sh/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
BIN=$HOME
SHACL=$HOME/shacl
DATA=/mnt/datagovbe
MIN_SIZE=24500100
# Git
USER=$GIT_USER
TOKEN=$GIT_TOKEN
NAME=$GIT_NAME
EMAIL=$GIT_EMAIL
LOCAL=dcat.git

# Create directories (if not yet present)
makedirs() {
Expand Down Expand Up @@ -114,7 +121,32 @@ compress() {
# Parameter: project code
publish() {
step $1 "publish"
status $1 "publish" $2 $?

F_SIZE=$(stat --format=%s $DATA/$1/datagovbe_edp.xml.gz)
if [[ $F_SIZE > $MIN_SIZE ]]; then
rm -rf $LOCAL

git clone --depth=1 https://$TOKEN@github.com/Fedict/dcat.git
git config user.name "$NAME"
git config user.email "$EMAIL"

cp $DATA/$1/datagovbe.nt.gz $LOCAL/all/datagovbe.nt.gz
cp $DATA/$1/datagovbe_edp.xml.gz $LOCAL/all/datagovbe_edp.xml.gz

cd $LOCAL
git commit -sam "Updated export"
git push

res=$?

cd -
rm -rf $LOCAL
else
echo "ERROR $F_SIZE is too small" > /mnt/logs/$1/publish.log
res=-1
fi

status $1 "publish" $2 $res
}

# Main
Expand All @@ -123,7 +155,7 @@ publish() {

source=$1

if [ ! -d $DATA/$source ]; then
if [[ ! -d $DATA/$source ]]; then
makedirs $source
fi

Expand All @@ -132,7 +164,7 @@ scrape $source
validate $source
convert $source

if [ $? -eq 0 ]; then
if [[ $? -eq 0 ]]; then
compress $source
publish $source
fi

0 comments on commit b00c878

Please sign in to comment.