Compare commits
	
		
			22 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 4ab9e5892d | |||
| a0c4fd8fec | |||
| 9bc0033d89 | |||
| a967e874a4 | |||
| 76811fe154 | |||
| 0329cf1214 | |||
| b1345ebaeb | |||
|  | 11bf1e5d0e | ||
|  | 1c3856e489 | ||
|  | c725901e60 | ||
|  | 2fbd14329c | ||
|  | e67b62bef1 | ||
|  | b62ed65111 | ||
|  | 9ee9df19a6 | ||
|  | 6c98481cd7 | ||
|  | 94432960e8 | ||
|  | bd74b67099 | ||
|  | 8ae204c7f9 | ||
|  | 8955348f61 | ||
|  | bc804fb864 | ||
|  | b989ed8652 | ||
|  | 78737a0c01 | 
							
								
								
									
										25
									
								
								CHANGELOG.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								CHANGELOG.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| # 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 | ||||
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							| @@ -13,6 +13,16 @@ 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` | ||||
|  | ||||
| ### `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 | ||||
|  | ||||
| ### `filename` | ||||
| @@ -28,6 +38,8 @@ The name of the built kpz file | ||||
|   with: | ||||
|     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. | ||||
|   | ||||
| @@ -1,5 +1,8 @@ | ||||
| name: 'Koha Plugin kpz Builder' | ||||
| description: 'Accepts a plugin name and version, and creates a Koha Plugin kpz file' | ||||
| branding: | ||||
|   icon: 'file' | ||||
|   color: 'green' | ||||
| inputs: | ||||
|   release-version:  # id of input | ||||
|     description: 'Version for this koha plugin release, e.g. v1.0.3' | ||||
| @@ -7,6 +10,10 @@ inputs: | ||||
|   release-name: | ||||
|     description: 'Name of plugin repo, e.g. koha-plugin-kitchen-sink' | ||||
|     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' | ||||
| @@ -16,3 +23,5 @@ runs: | ||||
|   args: | ||||
|     - ${{ inputs.release-version }} | ||||
|     - ${{ inputs.release-name }} | ||||
|     - ${{ inputs.minimum-version }} | ||||
|     - ${{ inputs.plugin-module }} | ||||
|   | ||||
| @@ -2,28 +2,65 @@ | ||||
|  | ||||
| PLUGIN_VERSION=$1 | ||||
| PLUGIN_NAME=$2 | ||||
|  | ||||
| RELEASE_FILENAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.kpz" | ||||
| TODAY_ISO=$(date '+%Y-%m-%d') | ||||
|  | ||||
| cd /github/workspace | ||||
| mkdir dist | ||||
| cp -r Koha dist/. | ||||
| cd dist | ||||
|  | ||||
| PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | sed '1q;d') | ||||
|  | ||||
| sed -i -e "s/{VERSION}/${PLUGIN_VERSION}/g" ${PLUGIN_MODULE} | ||||
| sed -i -e "s/1900-01-01/${TODAY_ISO}/g" $PLUGIN_MODULE | ||||
|  | ||||
| zip -r ../${RELEASE_FILENAME} ./Koha | ||||
| cd .. | ||||
| rm -rf dist | ||||
| MINIMUM_VERSION=$3 | ||||
| PLUGIN_MODULE=$4 | ||||
|  | ||||
| echo "PLUGIN VERSION: $PLUGIN_VERSION" | ||||
| echo "PLUGIN NAME: $PLUGIN_NAME" | ||||
| echo "TODAY ISO: $TODAY_ISO" | ||||
| echo "MINIMUM VERSION: $MINIMUM_VERSION" | ||||
|  | ||||
| RELEASE_FILENAME="${PLUGIN_NAME}-${PLUGIN_VERSION}.kpz" | ||||
| echo "RELEASE FILENAME: $RELEASE_FILENAME" | ||||
|  | ||||
| TODAY_ISO=$(date '+%Y-%m-%d') | ||||
| echo "TODAY ISO: $TODAY_ISO" | ||||
|  | ||||
| #cd /github/workspace | ||||
| echo "$(pwd)" | ||||
| mkdir -v dist | ||||
| cp -rv Koha dist/. | ||||
| cd dist | ||||
| pwd | ||||
|  | ||||
| [ -z "$PLUGIN_MODULE" ] && PLUGIN_MODULE=$(find . -regex '\./Koha/Plugin/.*[A-Za-z]*\.pm$' | head -1 | 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/{MINIMUM_VERSION}/${MINIMUM_VERSION}/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 | ||||
| [ -z "$PLUGIN_YML" ] || cp ${PLUGIN_YML} .. # Copy munged PLUGIN.yml to the root directory | ||||
| cd .. | ||||
| rm -rf dist | ||||
|  | ||||
| echo ::set-output name=filename::${RELEASE_FILENAME} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	