Add: feature to build a specific tag
This commit is contained in:
parent
ef5f2d5ff3
commit
1f844d0e35
|
@ -10,6 +10,7 @@ PACK_DIR="${SCRIPT_PATH}/package"
|
|||
|
||||
BUILD_DIR="$REPO_DIR/bin"
|
||||
ROOTFS="${SCRIPT_PATH}/rootfs"
|
||||
TARGET_TAG=""
|
||||
|
||||
ACTION="initialze"
|
||||
|
||||
|
@ -24,17 +25,22 @@ function usage()
|
|||
{
|
||||
echo "$0 usage:"
|
||||
echo " -b the build release number"
|
||||
echo " -t specify the tag to build, instead of the latest one"
|
||||
}
|
||||
|
||||
BUILD_REL=""
|
||||
while getopts ":b" arg
|
||||
while getopts ":b:t:" arg
|
||||
do
|
||||
case "$arg" in
|
||||
b)
|
||||
BUILD_REL="$OPTARG"
|
||||
;;
|
||||
t)
|
||||
TARGET_TAG="$OPTARG"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
@ -51,9 +57,18 @@ function download()
|
|||
git -C "$REPO_DIR" fetch --all
|
||||
fi
|
||||
|
||||
LATEST_TAG=$(git -C "$REPO_DIR" tag --sort=-version:refname --list 'v*' | head -n 1)
|
||||
echo "switching to tag: $LATEST_TAG"
|
||||
git -C "$REPO_DIR" switch --detach "$LATEST_TAG"
|
||||
}
|
||||
|
||||
function switch_tag()
|
||||
{
|
||||
ACTION="switch tag"
|
||||
if [ -z "$TARGET_TAG" ]
|
||||
then
|
||||
TARGET_TAG=$(git -C "$REPO_DIR" tag --sort=-version:refname --list 'v*' | head -n 1)
|
||||
fi
|
||||
|
||||
echo "switching to tag: $TARGET_TAG"
|
||||
git -C "$REPO_DIR" switch --detach "$TARGET_TAG"
|
||||
}
|
||||
|
||||
function build()
|
||||
|
@ -100,6 +115,7 @@ EOF
|
|||
|
||||
|
||||
download
|
||||
switch_tag
|
||||
build
|
||||
package
|
||||
|
||||
|
|
Loading…
Reference in a new issue