1
0

Add ability to set plugin's minimum Koha version

This commit is contained in:
Kyle M Hall 2020-04-16 08:10:33 -04:00
parent 8955348f61
commit 8ae204c7f9
3 changed files with 13 additions and 0 deletions

View File

@ -13,6 +13,12 @@ The file will be in your GitHub workspace after the action is run.
**Required** Name of plugin, should almost always be the repo name, e.g. `koha-plugin-kitchen-sink` **Required** Name of plugin, should almost always be the repo name, e.g. `koha-plugin-kitchen-sink`
### `minimmum-version`
**Required** Minimum version of Koha this plugin is compatible with, e.g. `19.11` or `19.11.03`
Best practice is to keep plugins compatible across all currently supported versions of Koha
## Outputs ## Outputs
### `filename` ### `filename`
@ -28,6 +34,7 @@ The name of the built kpz file
with: with:
release-version: ${{ steps.semvers.outputs.v_patch }} release-version: ${{ steps.semvers.outputs.v_patch }}
release-name: ${{ steps.myvars.outputs.GITHUB_REPO }} release-name: ${{ steps.myvars.outputs.GITHUB_REPO }}
minimum-version: ${{ steps.myvars.outputs.MINIMUM_VERSION }}
``` ```
Take a look at https://github.com/bywatersolutions/koha-plugin-kitchen-sink/blob/master/.github/workflows/main.yml for a real world usage. Take a look at https://github.com/bywatersolutions/koha-plugin-kitchen-sink/blob/master/.github/workflows/main.yml for a real world usage.

View File

@ -10,6 +10,8 @@ inputs:
release-name: release-name:
description: 'Name of plugin repo, e.g. koha-plugin-kitchen-sink' description: 'Name of plugin repo, e.g. koha-plugin-kitchen-sink'
required: true required: true
minimum-version:
description: 'Minimum version of Koha this plugin is compatible with e.g. 19.11'
outputs: outputs:
filename: # id of output filename: # id of output
description: 'The name of the built kpz file' description: 'The name of the built kpz file'

View File

@ -2,6 +2,7 @@
PLUGIN_VERSION=$1 PLUGIN_VERSION=$1
PLUGIN_NAME=$2 PLUGIN_NAME=$2
MINIMUM_VERSION=$3
RELEASE_FILENAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.kpz" RELEASE_FILENAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.kpz"
TODAY_ISO=$(date '+%Y-%m-%d') TODAY_ISO=$(date '+%Y-%m-%d')
@ -15,10 +16,12 @@ PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | sed '1q;d')
META_YML=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*/META\.yml$' | sed '1q;d') META_YML=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*/META\.yml$' | sed '1q;d')
sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${PLUGIN_MODULE} sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${PLUGIN_MODULE}
sed -i -e "s/{MINIMUM_VERSION}/${MINIMUM_VERSION}/g" ${PLUGIN_MODULE}
sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $PLUGIN_MODULE sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $PLUGIN_MODULE
if [ -f "$META_YML" ]; then if [ -f "$META_YML" ]; then
sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${META_YML} sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${META_YML}
sed -i -e "s/{MINIMUM_VERSION}/${MINIMUM_VERSION}/g" ${META_YML}
sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $META_YML sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $META_YML
cat $META_YML cat $META_YML
fi fi
@ -27,6 +30,7 @@ zip -r ../${RELEASE_FILENAME} ./Koha
cd .. cd ..
rm -rf dist rm -rf dist
echo "MINIMUM VERSION: $MINIMUM_VERSION"
echo "PLUGIN VERSION: $PLUGIN_VERSION" echo "PLUGIN VERSION: $PLUGIN_VERSION"
echo "PLUGIN NAME: $PLUGIN_NAME" echo "PLUGIN NAME: $PLUGIN_NAME"
echo "TODAY ISO: $TODAY_ISO" echo "TODAY ISO: $TODAY_ISO"