Skip to content

Commit

Permalink
switch to releases
Browse files Browse the repository at this point in the history
  • Loading branch information
vilmibm committed Aug 25, 2021
1 parent cead3ab commit 9fb5e40
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 25 deletions.
10 changes: 0 additions & 10 deletions build.sh

This file was deleted.

Binary file removed builds/darwin-x86_64
Binary file not shown.
Binary file removed builds/linux-i386
Binary file not shown.
Binary file removed builds/linux-x86_64
Binary file not shown.
Binary file removed builds/windows-i386
Binary file not shown.
Binary file removed builds/windows-x86_64
Binary file not shown.
42 changes: 27 additions & 15 deletions gh-user-status
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@
#!/bin/bash
set -e

repo="vilmibm/gh-user-status"
tag="v1.0.0"

extensionPath="$(dirname "$0")"
arch="$(uname -m)"

exe=""

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

if [ "$(which go)" = "" ]; then
echo "go must be installed to use this gh extension on this platform"
exit 1
fi
if [ "${exe}" == "" ]; then
if [ "$(which go)" = "" ]; then
echo "go must be installed to use this gh extension on this platform"
exit 1
fi

exe="cmd.out"
exe="cmd.out"

cd "${extensionPath}" > /dev/null
go build -o "${exe}"
cd - > /dev/null
cd "${extensionPath}" > /dev/null
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}"
fi
fi

exec "${extensionPath}/${exe}" "$@"
20 changes: 20 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e

# TODO ARM support. figure out mapping to uname -m output.

tag="${1}"

if [ "${tag}" == "" ]; then
echo "tag argument required"
exit 1
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

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

0 comments on commit 9fb5e40

Please sign in to comment.