2019-12-18 15:26:30 +01:00
|
|
|
#!/bin/sh -l
|
|
|
|
|
|
|
|
PLUGIN_VERSION=$1
|
|
|
|
PLUGIN_NAME=$2
|
2020-04-16 13:35:17 +02:00
|
|
|
KOHA_VERSION=$3
|
|
|
|
|
|
|
|
if [ -z "$KOHA_VERSION" ]
|
|
|
|
PLUGIN_VERSION="$KOHA_VERSION.$PLUGIN_VERSION"
|
|
|
|
fi
|
2019-12-18 15:26:30 +01:00
|
|
|
|
|
|
|
RELEASE_FILENAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.kpz"
|
|
|
|
TODAY_ISO=$(date '+%Y-%m-%d')
|
|
|
|
|
|
|
|
cd /github/workspace
|
|
|
|
mkdir dist
|
|
|
|
cp -r Koha dist/.
|
|
|
|
cd dist
|
|
|
|
|
2019-12-18 19:39:01 +01:00
|
|
|
PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | sed '1q;d')
|
2020-04-16 13:12:22 +02:00
|
|
|
META_YML=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*/META\.yml$' | sed '1q;d')
|
2019-12-18 15:26:30 +01:00
|
|
|
|
|
|
|
sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${PLUGIN_MODULE}
|
|
|
|
sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $PLUGIN_MODULE
|
|
|
|
|
2020-04-16 13:12:22 +02:00
|
|
|
if [ -f "$META_YML" ]; then
|
|
|
|
sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${META_YML}
|
|
|
|
sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $META_YML
|
|
|
|
cat $META_YML
|
|
|
|
fi
|
|
|
|
|
2019-12-18 15:26:30 +01:00
|
|
|
zip -r ../${RELEASE_FILENAME} ./Koha
|
|
|
|
cd ..
|
|
|
|
rm -rf dist
|
|
|
|
|
2020-04-16 13:35:17 +02:00
|
|
|
echo "KOHA VERSION: $KOHA_VERSION"
|
2019-12-18 15:26:30 +01:00
|
|
|
echo "PLUGIN VERSION: $PLUGIN_VERSION"
|
|
|
|
echo "PLUGIN NAME: $PLUGIN_NAME"
|
|
|
|
echo "TODAY ISO: $TODAY_ISO"
|
|
|
|
echo "RELEASE FILENAME: $RELEASE_FILENAME"
|
|
|
|
echo "PLUGIN MODULE: $PLUGIN_MODULE"
|
|
|
|
|
|
|
|
echo ::set-output name=filename::${RELEASE_FILENAME}
|