You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1009 B
36 lines
1009 B
1 week ago
|
#!/bin/bash
|
||
|
|
||
|
GO_VERSION=$(go version | awk '{for(i=1; i<NF; i++){if($i ~ /^go[0-9]/){sub(/go/,"",$i);print $i}}}')
|
||
|
|
||
|
VERSION=$(cat ./VERSION)
|
||
|
[ -z "$GO_VERSION" ] && { echo "variable GO_VERSION is not set!"; exit 1; }
|
||
|
[ -z "$VERSION" ] && { echo "variable VERSION is not set!"; exit 1; }
|
||
|
|
||
|
echo "VERSION $VERSION"
|
||
|
echo "GO_VERSION $GO_VERSION"
|
||
|
|
||
|
BRANCH=$VERSION
|
||
|
VERSION=$(echo "$VERSION" | sed 's/v//')
|
||
|
SPEC_FILE=$(ls *.spec | head -n 1)
|
||
|
sed -i "s/Version.*$/Version: ${VERSION}/1" $SPEC_FILE
|
||
|
|
||
|
sudo rm -rf ./source || exit 1
|
||
|
mkdir ./source
|
||
|
pushd ./source >/dev/null || exit 1
|
||
|
git clone --branch $BRANCH https://github.com/goodwithtech/dockle.git
|
||
|
pushd ./dockle >/dev/null || exit 1
|
||
|
sed -Ei "s/go\s+[0-9]+.*$/go ${GO_VERSION}/1" go.mod
|
||
|
export GOPATH=${PWD}/mod
|
||
|
go mod tidy
|
||
|
rm -rf ./.github
|
||
|
rm -rf ./.git
|
||
|
rm -rf ./.vex
|
||
|
popd >/dev/null
|
||
|
|
||
|
mv ./dockle ./dockle-$VERSION
|
||
|
tar -cvaf dockle-${VERSION}.tar.xz dockle-$VERSION || exit 1
|
||
|
mv dockle-${VERSION}.tar.xz ./..
|
||
|
popd >/dev/null
|
||
|
sudo rm -rf ./source
|
||
|
|