1
0

Add ability to specify the plugin module manually

This commit is contained in:
Kyle M Hall 2020-08-17 11:05:16 -04:00
parent e67b62bef1
commit 2fbd14329c
3 changed files with 11 additions and 2 deletions

View File

@ -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` **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 Best practice is to keep plugins compatible across all currently supported versions of Koha
## Outputs ## Outputs
@ -35,6 +39,7 @@ The name of the built kpz file
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.koha-version-oldstable.outputs.version-major-minor }} 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. 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

@ -12,6 +12,8 @@ inputs:
required: true required: true
minimum-version: minimum-version:
description: 'Minimum version of Koha this plugin is compatible with e.g. 19.11' 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: 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'
@ -22,3 +24,4 @@ runs:
- ${{ inputs.release-version }} - ${{ inputs.release-version }}
- ${{ inputs.release-name }} - ${{ inputs.release-name }}
- ${{ inputs.minimum-version }} - ${{ inputs.minimum-version }}
- ${{ inputs.plugin-module }}

View File

@ -3,6 +3,7 @@
PLUGIN_VERSION=$1 PLUGIN_VERSION=$1
PLUGIN_NAME=$2 PLUGIN_NAME=$2
MINIMUM_VERSION=$3 MINIMUM_VERSION=$3
PLUGIN_MODULE=$4
echo "PLUGIN VERSION: $PLUGIN_VERSION" echo "PLUGIN VERSION: $PLUGIN_VERSION"
echo "PLUGIN NAME: $PLUGIN_NAME" echo "PLUGIN NAME: $PLUGIN_NAME"
@ -19,7 +20,7 @@ mkdir dist
cp -r Koha dist/. cp -r Koha dist/.
cd 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" echo "PLUGIN MODULE: $PLUGIN_MODULE"
PLUGIN_YML=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*/PLUGIN\.yml$' | sed '1q;d') PLUGIN_YML=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*/PLUGIN\.yml$' | sed '1q;d')
@ -52,7 +53,7 @@ else
fi fi
zip -r ../${RELEASE_FILENAME} ./Koha 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 .. cd ..
rm -rf dist rm -rf dist