Skip to content
Snippets Groups Projects
Unverified Commit c386b15f authored by Massimiliano Adamo's avatar Massimiliano Adamo
Browse files

testing git tags

parent 0a7975f6
No related branches found
No related tags found
No related merge requests found
Pipeline #29419 passed
...@@ -20,7 +20,7 @@ upload_linux_binary: ...@@ -20,7 +20,7 @@ upload_linux_binary:
only: only:
- tags - tags
script: script:
- ./build.sh --os=linux --arch=amd64 --upx - ./build.sh --os=linux --arch=amd64 --version=$CI_COMMIT_TAG --upx
- 'curl --header "JOB-TOKEN: $PROJECT_ACCESS_TOKEN" --upload-file $CI_PROJECT_NAME "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}"' - 'curl --header "JOB-TOKEN: $PROJECT_ACCESS_TOKEN" --upload-file $CI_PROJECT_NAME "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${CI_PROJECT_NAME}"'
tags: tags:
- visnu_shell - visnu_shell
...@@ -11,7 +11,7 @@ unset GOBIN ...@@ -11,7 +11,7 @@ unset GOBIN
BIN_NAME=acme-downloader BIN_NAME=acme-downloader
PATH=$PATH:$(go env GOPATH)/bin PATH=$PATH:$(go env GOPATH)/bin
GOPATH=$(go env GOPATH) GOPATH=$(go env GOPATH)
PROG_VERSION="1.0" #PROG_VERSION="1.0"
BUILDTIME=$(date -u '+%Y-%m-%d_%H:%M:%S') BUILDTIME=$(date -u '+%Y-%m-%d_%H:%M:%S')
REPO_DIR=$(dirname $0) REPO_DIR=$(dirname $0)
if [ "$REPO_DIR" = '.' ]; then if [ "$REPO_DIR" = '.' ]; then
...@@ -30,6 +30,7 @@ usage() { ...@@ -30,6 +30,7 @@ usage() {
echo " --arch=ARCH (Compile binary for this Architecture)" echo " --arch=ARCH (Compile binary for this Architecture)"
echo " --upx (Enable UPX compression)" echo " --upx (Enable UPX compression)"
echo " --no-upx (Disable UPX compression)" echo " --no-upx (Disable UPX compression)"
echo " --version (Version number. If not used it will be the latest tag)"
echo "" echo ""
echo " Below is a list of supported OS/Arch combinations:" echo " Below is a list of supported OS/Arch combinations:"
echo "OS ARCH" echo "OS ARCH"
...@@ -37,7 +38,7 @@ usage() { ...@@ -37,7 +38,7 @@ usage() {
exit exit
} }
OPTS=$(getopt -o "h" --longoptions "help,os:,arch:,upx,no-upx" -- "$@") OPTS=$(getopt -o "h" --longoptions "help,os:,arch:,upx,no-upx:,version:" -- "$@")
eval set -- "$OPTS" eval set -- "$OPTS"
while true; do while true; do
...@@ -59,6 +60,10 @@ while true; do ...@@ -59,6 +60,10 @@ while true; do
--no-upx) --no-upx)
NOUPX='NOUPX' NOUPX='NOUPX'
;; ;;
--version)
shift
VERSION="$1"
;;
--) --)
shift shift
break break
...@@ -67,6 +72,12 @@ while true; do ...@@ -67,6 +72,12 @@ while true; do
shift shift
done done
if [ -z $VERSION ]; then
PROG_VERSION=$(git describe --tags $(git rev-list --tags --max-count=1) | tr -d v)
else
PROG_VERSION=$(echo $PROG_VERSION | tr -f v)
fi
if [ -z $OS ] || [ -z $ARCH ]; then if [ -z $OS ] || [ -z $ARCH ]; then
echo -e "\nYou need to supply OS and Architecture\n" echo -e "\nYou need to supply OS and Architecture\n"
usage usage
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment