Skip to content

Commit

Permalink
fix upgrade problem
Browse files Browse the repository at this point in the history
  • Loading branch information
vilmibm committed Aug 25, 2021
1 parent 2f8fe71 commit ad42280
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
27 changes: 14 additions & 13 deletions gh-screensaver
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

repo="vilmibm/gh-screensaver"
tag="v1.0.1"
tag="v1.0.2"

extensionPath="$(dirname "$0")"
arch="$(uname -m)"
Expand All @@ -11,23 +11,23 @@ exe=""

if uname -a | grep Msys > /dev/null; then
if [ $arch = "x86_64" ]; then
exe="windows-x86_64"
exe="windows-x86_64-${tag}"
elif [ $arch = "i686" ]; then
exe="windows-i386"
exe="windows-i386-${tag}"
elif [ $arch = "i386" ]; then
exe="windows-i386"
exe="windows-i386-${tag}"
fi
elif uname -a | grep Darwin > /dev/null; then
if [ $arch = "x86_64" ]; then
exe="darwin-x86_64"
exe="darwin-x86_64-${tag}"
fi
elif uname -a | grep Linux > /dev/null; then
if [ $arch = "x86_64" ]; then
exe="linux-x86_64"
exe="linux-x86_64-${tag}"
elif [ $arch = "i686" ]; then
exe="linux-i386"
exe="linux-i386-${tag}"
elif [ $arch = "i386" ]; then
exe="linux-i386"
exe="linux-i386-${tag}"
fi
fi

Expand All @@ -43,11 +43,12 @@ if [ "${exe}" == "" ]; then
go build -o "${exe}"
cd - > /dev/null
else
if [[ ! -x "${extensionPath}/${exe}" ]]; then
rm -f "${extensionPath}/${exe}"
gh release -R"${repo}" download "${tag}" -p "${exe}" --dir="${extensionPath}"
chmod +x "${extensionPath}/${exe}"
if [[ ! -x "${extensionPath}/bin/${exe}" ]]; then
mkdir -p bin
rm -f "${extensionPath}/bin/*"
gh release -R"${repo}" download "${tag}" -p "${exe}" --dir="${extensionPath}/bin"
chmod +x "${extensionPath}/bin/*"
fi
fi

exec "${extensionPath}/${exe}" "$@"
exec "${extensionPath}/bin/${exe}" "$@"
10 changes: 5 additions & 5 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ if [ "${tag}" == "" ]; then
fi

rm -rf dist
GOOS=darwin GOARCH=amd64 go build -o dist/darwin-x86_64
GOOS=linux GOARCH=386 go build -o dist/linux-i386
GOOS=linux GOARCH=amd64 go build -o dist/linux-x86_64
GOOS=windows GOARCH=386 go build -o dist/windows-i386
GOOS=windows GOARCH=amd64 go build -o dist/windows-x86_64
GOOS=darwin GOARCH=amd64 go build -o "dist/darwin-x86_64-${tag}"
GOOS=linux GOARCH=386 go build -o "dist/linux-i386-${tag}"
GOOS=linux GOARCH=amd64 go build -o "dist/linux-x86_64-${tag}"
GOOS=windows GOARCH=386 go build -o "dist/windows-i386-${tag}"
GOOS=windows GOARCH=amd64 go build -o "dist/windows-x86_64-${tag}"

gh release create $tag ./dist/* --title="${tag}" --notes "${tag}"

0 comments on commit ad42280

Please sign in to comment.