-
Notifications
You must be signed in to change notification settings - Fork 14
/
dist.sh
executable file
·33 lines (27 loc) · 951 Bytes
/
dist.sh
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
#!/bin/bash
set -euo pipefail
version=${1:-}
BASE_DIR=$(git rev-parse --show-toplevel)
function usage() {
echo "Usage: `basename $0` <version>"
echo " where <version> is application's new version"
exit 1
}
function create_version() {
mkdir -p $BASE_DIR/target
if [ "$cleandist" = "true" ]; then
echo "cleaning dist directory"
rm -rf $BASE_DIR/target/dist && rm -rf $BASE_DIR/valpas-web/dist
fi
git archive --format=tar --prefix=dist/ HEAD | (cd $BASE_DIR/target && tar xf -)
if [ "$version" == "local" ]; then
(cd $BASE_DIR/target/dist && mvn install -DskipTests=true)
else
(cd $BASE_DIR/target/dist && mvn versions:set -DnewVersion=$version)
(cd $BASE_DIR/target/dist && make clean && mvn deploy --batch-mode -DskipTests=true -Dmaven.skip.install=true -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/Opetushallitus/koski)
fi
}
if [ -z "$version" ]; then
usage
fi
create_version