From 2fbd14329cc4dfda74b59fee3c49bac45d5b4b22 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 17 Aug 2020 11:05:16 -0400 Subject: [PATCH] Add ability to specify the plugin module manually --- README.md | 5 +++++ action.yml | 3 +++ entrypoint.sh | 5 +++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 990871b..6c6b065 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ The file will be in your GitHub workspace after the action is run. **Required** Minimum version of Koha this plugin is compatible with, e.g. `19.11` or `19.11.03` +### `plugin-module` + +**Optional** Path to the plugin module file, relative to the plugin root directory. If not provided, action will attempt to auto-detect the module path. + Best practice is to keep plugins compatible across all currently supported versions of Koha ## Outputs @@ -35,6 +39,7 @@ The name of the built kpz file release-version: ${{ steps.semvers.outputs.v_patch }} release-name: ${{ steps.myvars.outputs.GITHUB_REPO }} minimum-version: ${{ steps.koha-version-oldstable.outputs.version-major-minor }} + plugin-module: 'Path/To/Plugin/Module.pm" ``` Take a look at https://github.com/bywatersolutions/koha-plugin-kitchen-sink/blob/master/.github/workflows/main.yml for a real world usage. diff --git a/action.yml b/action.yml index 7ed0031..9532296 100644 --- a/action.yml +++ b/action.yml @@ -12,6 +12,8 @@ inputs: required: true minimum-version: description: 'Minimum version of Koha this plugin is compatible with e.g. 19.11' + plugin-module: + description: 'Path to the plugin module relative to the plugin directory root, e.g. Koha/Plugin/Com/ByWaterSolutions/CurbsidePickup.pm' outputs: filename: # id of output description: 'The name of the built kpz file' @@ -22,3 +24,4 @@ runs: - ${{ inputs.release-version }} - ${{ inputs.release-name }} - ${{ inputs.minimum-version }} + - ${{ inputs.plugin-module }} diff --git a/entrypoint.sh b/entrypoint.sh index f91c057..074fca6 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,6 +3,7 @@ PLUGIN_VERSION=$1 PLUGIN_NAME=$2 MINIMUM_VERSION=$3 +PLUGIN_MODULE=$4 echo "PLUGIN VERSION: $PLUGIN_VERSION" echo "PLUGIN NAME: $PLUGIN_NAME" @@ -19,7 +20,7 @@ mkdir dist cp -r Koha dist/. cd dist -PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | tail -1 | sed '1q;d') +[ -z "$PLUGIN_MODULE" ] && PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | tail -1 | sed '1q;d') echo "PLUGIN MODULE: $PLUGIN_MODULE" PLUGIN_YML=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*/PLUGIN\.yml$' | sed '1q;d') @@ -52,7 +53,7 @@ else fi zip -r ../${RELEASE_FILENAME} ./Koha -cp ${PLUGIN_YML} .. # Copy munged PLUGIN.yml to the root directory +[ -z "$PLUGIN_YML" ] || cp ${PLUGIN_YML} .. # Copy munged PLUGIN.yml to the root directory cd .. rm -rf dist