1
0

Compare commits

..

No commits in common. "master" and "v2" have entirely different histories.
master ... v2

4 changed files with 11 additions and 91 deletions

View File

@ -1,25 +0,0 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.2] - 2020-04-16
### Changed
- If the plugin contains submodules, one of those submodules may be selected by accident. This should be fixed.
## [1.0.1] - 2020-04-16
### Changed
- Wrong directory was being checked for readme and changelog files
## [1.0.0] - 2020-04-16
### Added
- This changelog
- If README.md is present in the root directory of the plugin, it will be copied into the plugin's data directory before create the kpz file
- The same as above, but for CHANGELOG.md as well
### Changed
- Nothing
### Removed
- Nothing

View File

@ -13,16 +13,6 @@ 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`
### `minimum-version`
**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 ## Outputs
### `filename` ### `filename`
@ -38,8 +28,6 @@ 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.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

@ -10,10 +10,6 @@ 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'
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'
@ -23,5 +19,3 @@ runs:
args: args:
- ${{ inputs.release-version }} - ${{ inputs.release-version }}
- ${{ inputs.release-name }} - ${{ inputs.release-name }}
- ${{ inputs.minimum-version }}
- ${{ inputs.plugin-module }}

View File

@ -2,65 +2,28 @@
PLUGIN_VERSION=$1 PLUGIN_VERSION=$1
PLUGIN_NAME=$2 PLUGIN_NAME=$2
MINIMUM_VERSION=$3
PLUGIN_MODULE=$4
echo "PLUGIN VERSION: $PLUGIN_VERSION"
echo "PLUGIN NAME: $PLUGIN_NAME"
echo "MINIMUM VERSION: $MINIMUM_VERSION"
RELEASE_FILENAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.kpz" RELEASE_FILENAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.kpz"
echo "RELEASE FILENAME: $RELEASE_FILENAME"
TODAY_ISO=$(date '+%Y-%m-%d') TODAY_ISO=$(date '+%Y-%m-%d')
echo "TODAY ISO: $TODAY_ISO"
#cd /github/workspace cd /github/workspace
echo "$(pwd)" mkdir dist
mkdir -v dist cp -r Koha dist/.
cp -rv Koha dist/.
cd dist cd dist
pwd
[ -z "$PLUGIN_MODULE" ] && PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | head -1 | sed '1q;d') PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | sed '1q;d')
echo "PLUGIN MODULE: $PLUGIN_MODULE"
PLUGIN_YML=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*/PLUGIN\.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/{DATE_UPDATED}/${TODAY_ISO}/g" ${PLUGIN_MODULE}
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/{DATE_UPDATED}/${TODAY_ISO}/g" ${PLUGIN_YML}
cat $PLUGIN_YML
fi
PLUGIN_DIR=${PLUGIN_MODULE::-3}
echo "PLUGIN DIR: $PLUGIN_DIR"
if [ ! -d $PLUGIN_DIR ]; then
mkdir -v $PLUGIN_DIR
fi
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"
fi
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"
fi
zip -r ../${RELEASE_FILENAME} ./Koha zip -r ../${RELEASE_FILENAME} ./Koha
[ -z "$PLUGIN_YML" ] || cp ${PLUGIN_YML} .. # Copy munged PLUGIN.yml to the root directory
cd .. cd ..
rm -rf dist rm -rf dist
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} echo ::set-output name=filename::${RELEASE_FILENAME}