2019-12-18 15:26:30 +01:00
|
|
|
#!/bin/sh -l
|
|
|
|
|
|
|
|
PLUGIN_VERSION=$1
|
|
|
|
PLUGIN_NAME=$2
|
2020-04-16 14:10:33 +02:00
|
|
|
MINIMUM_VERSION=$3
|
2020-08-17 17:05:16 +02:00
|
|
|
PLUGIN_MODULE=$4
|
2019-12-18 15:26:30 +01:00
|
|
|
|
2020-04-16 15:38:32 +02:00
|
|
|
echo "PLUGIN VERSION: $PLUGIN_VERSION"
|
|
|
|
echo "PLUGIN NAME: $PLUGIN_NAME"
|
|
|
|
echo "MINIMUM VERSION: $MINIMUM_VERSION"
|
|
|
|
|
2019-12-18 15:26:30 +01:00
|
|
|
RELEASE_FILENAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.kpz"
|
2020-04-16 15:38:32 +02:00
|
|
|
echo "RELEASE FILENAME: $RELEASE_FILENAME"
|
|
|
|
|
2019-12-18 15:26:30 +01:00
|
|
|
TODAY_ISO=$(date '+%Y-%m-%d')
|
2020-04-16 15:38:32 +02:00
|
|
|
echo "TODAY ISO: $TODAY_ISO"
|
2019-12-18 15:26:30 +01:00
|
|
|
|
|
|
|
cd /github/workspace
|
|
|
|
mkdir dist
|
|
|
|
cp -r Koha dist/.
|
|
|
|
cd dist
|
|
|
|
|
2020-08-17 17:05:16 +02:00
|
|
|
[ -z "$PLUGIN_MODULE" ] && PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | tail -1 | sed '1q;d')
|
2020-04-16 15:38:32 +02:00
|
|
|
echo "PLUGIN MODULE: $PLUGIN_MODULE"
|
2020-04-22 14:42:04 +02:00
|
|
|
PLUGIN_YML=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*/PLUGIN\.yml$' | sed '1q;d')
|
2019-12-18 15:26:30 +01:00
|
|
|
|
|
|
|
sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${PLUGIN_MODULE}
|
2020-04-16 14:10:33 +02:00
|
|
|
sed -i -e "s/{MINIMUM_VERSION}/${MINIMUM_VERSION}/g" ${PLUGIN_MODULE}
|
2019-12-18 15:26:30 +01:00
|
|
|
sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $PLUGIN_MODULE
|
|
|
|
|
2020-04-22 14:42:04 +02:00
|
|
|
if [ -f "$PLUGIN_YML" ]; then
|
|
|
|
sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${PLUGIN_YML}
|
|
|
|
sed -i -e "s/{MINIMUM_VERSION}/${MINIMUM_VERSION}/g" ${PLUGIN_YML}
|
|
|
|
sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $PLUGIN_YML
|
|
|
|
cat $PLUGIN_YML
|
2020-04-16 13:12:22 +02:00
|
|
|
fi
|
|
|
|
|
2020-04-16 19:43:23 +02:00
|
|
|
PLUGIN_DIR=${PLUGIN_MODULE::-3}
|
2020-04-16 20:11:57 +02:00
|
|
|
echo "PLUGIN DIR: $PLUGIN_DIR"
|
2020-04-16 19:43:23 +02:00
|
|
|
|
2020-04-16 20:11:57 +02:00
|
|
|
if [ -f "../CHANGELOG.md" ]; then
|
|
|
|
echo "CHANGELOG.md found, copying to plugin directory"
|
|
|
|
cp ../CHANGELOG.md "$PLUGIN_DIR/CHANGELOG.md"
|
|
|
|
else
|
|
|
|
echo "CHANGELOG.md not found, please add a CHANGELOG.md file to your plugin's root directory"
|
2020-04-16 19:43:23 +02:00
|
|
|
fi
|
|
|
|
|
2020-04-16 20:11:57 +02:00
|
|
|
if [ -f "../README.md" ]; then
|
|
|
|
echo "README.md found, copying to plugin directory"
|
|
|
|
cp ../README.md "$PLUGIN_DIR/README.md"
|
|
|
|
else
|
|
|
|
echo "README.md not found, please add a README.md file to your plugin's root directory"
|
2020-04-16 19:43:23 +02:00
|
|
|
fi
|
|
|
|
|
2019-12-18 15:26:30 +01:00
|
|
|
zip -r ../${RELEASE_FILENAME} ./Koha
|
2020-08-17 17:05:16 +02:00
|
|
|
[ -z "$PLUGIN_YML" ] || cp ${PLUGIN_YML} .. # Copy munged PLUGIN.yml to the root directory
|
2019-12-18 15:26:30 +01:00
|
|
|
cd ..
|
|
|
|
rm -rf dist
|
|
|
|
|
|
|
|
echo ::set-output name=filename::${RELEASE_FILENAME}
|
2020-12-03 16:46:27 +01:00
|
|
|
|
|
|
|
echo "GIT DIFF:"
|
|
|
|
git diff
|