-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·61 lines (52 loc) · 1.59 KB
/
build.sh
File metadata and controls
executable file
·61 lines (52 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Copyright 2025 Hypernova Oy
# Copyright 2020 The National Library of Finland
function increment_version {
VERSION="$1"
VERSION=`echo "$VERSION" | perl -pe 's/^((\d+\.)*)(\d+)(.*)$/$1.($3+1).$4/e'`
echo "incremented version VERSION='$VERSION'"
}
function get_latest_version {
VERSION=`git log --pretty=oneline --decorate | egrep -o "tag: v[0-9.]+" | sed -e "s/tag: v//" | head -n 1`
if [ -z "$VERSION" ]; then
VERSION="0.0.0"
fi
echo "got latest version VERSION='$VERSION'"
}
function create_new_version_tag {
get_latest_version
increment_version "$VERSION"
git tag "v$VERSION"
echo "created new version tag 'v$VERSION'"
}
function replace_variable {
VAR="$1";
eval VAL="\$$VAR";
echo "Replacing variable '\$$VAR' with '$VAL' in file 'dist/${PM_FILE}'";
perl -i -pe "s/^our\s+"'\$'""$VAR".+?#PLACEHOLDER\$/our "'\$'"$VAR = '$VAL'; #PLACEHOLDER/" "dist/${PM_FILE}"
}
function build_release_package {
echo "Building release package ${RELEASE_FILE}"
if [ -e ${RELEASE_FILE} ]
then
rm ${RELEASE_FILE}
fi
mkdir -p "dist/$BASEPATH"
cp -r $BASEPATH/* dist/$BASEPATH/
cp $PM_FILE dist/$PM_FILE
replace_variable VERSION
replace_variable DATE_UPDATED
cd dist
zip -r ../${RELEASE_FILE} ./Koha
cd ..
#rm -rf dist
}
VERSION=`git log -1 --pretty=oneline --decorate | egrep -o "tag: v[0-9.]+" | sed -e "s/tag: v//"`
if [ -z "$VERSION" ]; then
create_new_version_tag
fi
BASEPATH='Koha/Plugin/Fi/Hypernova/MARCFrameworkDiff'
PM_FILE="$BASEPATH.pm"
DATE_UPDATED=`date +"%Y-%m-%d"`
RELEASE_FILE="koha-plugin-marcframeworkdiff-${VERSION}.kpz"
build_release_package