Initial commit
This commit is contained in:
commit
42c85d1b6d
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --no-cache zip
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
27
README.md
Normal file
27
README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Koha Plugin kpz Builder
|
||||
|
||||
This action builds a kpz file from a given name and version.
|
||||
The file will be in your GitHub workspace after the action is run.
|
||||
|
||||
## Inputs
|
||||
|
||||
### `release-version`
|
||||
|
||||
**Required** Version for this koha plugin release, e.g. "v1.0.3"
|
||||
|
||||
### `release-name`
|
||||
|
||||
**Required** Name of plugin, should almost always be the repo name, e.g. "koha-plugin-kitchen-sink"
|
||||
|
||||
## Outputs
|
||||
|
||||
### `filename`
|
||||
|
||||
The name of the built kpz file
|
||||
|
||||
## Example usage
|
||||
|
||||
uses: actions/koha-plugin-create-kpz@v1
|
||||
with:
|
||||
release-version: 'v1.2.3'
|
||||
release-name: 'koha-plugin-kitchen-sink'
|
18
action.yml
Normal file
18
action.yml
Normal file
@ -0,0 +1,18 @@
|
||||
name: 'Koha Plugin kpz Builder'
|
||||
description: 'Accepts a plugin name and version, and creates a Koha Plugin kpz file'
|
||||
inputs:
|
||||
release-version: # id of input
|
||||
description: 'Version for this koha plugin release, e.g. v1.0.3'
|
||||
required: true
|
||||
release-name:
|
||||
description: 'Name of plugin repo, e.g. koha-plugin-kitchen-sink'
|
||||
required: true
|
||||
outputs:
|
||||
filename: # id of output
|
||||
description: 'The name of the built kpz file'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
args:
|
||||
- ${{ inputs.release-version }}
|
||||
- ${{ inputs.release-name }}
|
29
entrypoint.sh
Executable file
29
entrypoint.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/sh -l
|
||||
|
||||
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$' | tac | 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
|
||||
|
||||
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}
|
Loading…
Reference in New Issue
Block a user