Skip to content

Commit

Permalink
Merge pull request #4 from losisin/fix/goreleaser-goarch
Browse files Browse the repository at this point in the history
don't build goarch 386
  • Loading branch information
losisin authored Oct 24, 2023
2 parents 0831469 + d9232b9 commit 579e4e0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 44 deletions.
4 changes: 2 additions & 2 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ builds:
goarch:
- amd64
- arm64
- 386
binary: schema

archives:
- id: schema
format: tar.gz
format: tgz
files:
- LICENSE
- README.md
- plugin.yaml

checksum:
name_template: '{{ .ProjectName }}-checksum.sha'
algorithm: sha256

changelog:
Expand Down
48 changes: 7 additions & 41 deletions install-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

PROJECT_NAME="helm-values-schema-json"
PROJECT_GH="losisin/$PROJECT_NAME"
PROJECT_CHECKSUM_FILE="$PROJECT_NAME-checksum.sha"
HELM_PLUGIN_PATH="$HELM_PLUGIN_DIR"

# Convert the HELM_PLUGIN_PATH to unix if cygpath is
Expand Down Expand Up @@ -45,24 +44,24 @@ initOS() {
msys*) OS='windows';;
# Minimalist GNU for Windows
mingw*) OS='windows';;
darwin) OS='macos';;
darwin) OS='darwin';;
esac
}

# verifySupported checks that the os/arch combination is supported for
# binary builds.
verifySupported() {
supported="linux-arm64\nlinux-amd64\nmacos-amd64\nwindows-amd64\nmacos-arm64"
if ! echo "$supported" | grep -q "$OS-$ARCH"; then
echo "No prebuild binary for $OS-$ARCH."
supported="linux_arm64\nlinux_amd64\ndarwin_amd64\ndarwin_arm64\nwindows_amd64\nwindows_arm64"
if ! echo "$supported" | grep -q "${OS}_${ARCH}"; then
echo "No prebuild binary for ${OS}_${ARCH}."
exit 1
fi

if ! type "curl" >/dev/null 2>&1 && ! type "wget" >/dev/null 2>&1; then
echo "Either curl or wget is required"
exit 1
fi
echo "Support $OS-$ARCH"
echo "Support ${OS}_${ARCH}"
}

# getDownloadURL checks the latest available version.
Expand All @@ -76,9 +75,7 @@ getDownloadURL() {
fi

# Setup Download Url
DOWNLOAD_URL="https://github.com/$PROJECT_GH/releases/download/${version}/$PROJECT_NAME-$OS-$ARCH-${version#v}.tgz"
# Setup Checksum Url
PROJECT_CHECKSUM="https://github.com/$PROJECT_GH/releases/download/${version}/$PROJECT_CHECKSUM_FILE"
DOWNLOAD_URL="https://github.com/${PROJECT_GH}/releases/download/${version}/${PROJECT_NAME}-${OS}_${ARCH}-${version#v}.tgz"
}

# downloadFile downloads the latest binary package and also the checksum
Expand All @@ -95,41 +92,10 @@ downloadFile() {
fi
}

# installFile verifies the SHA256 for the file, then unpacks and
# installs it.
# installFile unpacks and installs the file
installFile() {
cd "/tmp"
DOWNLOAD_FILE=$(find ./_dist -name "*.tgz")
if [ -n "$PROJECT_CHECKSUM" ]; then
echo Validating Checksum.
if type "curl" >/dev/null 2>&1; then
if type "shasum" >/dev/null 2>&1; then
curl -s -L "$PROJECT_CHECKSUM" | grep "$DOWNLOAD_FILE" | shasum -a 256 -c -s
elif type "sha256sum" >/dev/null 2>&1; then
if grep -q "ID=alpine" /etc/os-release; then
curl -s -L "$PROJECT_CHECKSUM" | grep "$DOWNLOAD_FILE" | sha256sum -c -s
else
curl -s -L "$PROJECT_CHECKSUM" | grep "$DOWNLOAD_FILE" | sha256sum -c --status
fi
else
echo No Checksum as there is no shasum or sha256sum found.
fi
elif type "wget" >/dev/null 2>&1; then
if type "shasum" >/dev/null 2>&1; then
wget -q -O - "$PROJECT_CHECKSUM" | grep "$DOWNLOAD_FILE" | shasum -a 256 -c -s
elif type "sha256sum" >/dev/null 2>&1; then
if grep -q "ID=alpine" /etc/os-release; then
wget -q -O - "$PROJECT_CHECKSUM" | grep "$DOWNLOAD_FILE" | sha256sum -c -s
else
wget -q -O - "$PROJECT_CHECKSUM" | grep "$DOWNLOAD_FILE" | sha256sum -c --status
fi
else
echo No Checksum as there is no shasum or sha256sum found.
fi
fi
else
echo No Checksum validated.
fi
HELM_TMP="/tmp/$PROJECT_NAME"
mkdir -p "$HELM_TMP"
tar xf "$DOWNLOAD_FILE" -C "$HELM_TMP"
Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: "schema"
version: "0.1.1"
version: "0.1.2"
usage: "generate values.schema.json from values yaml"
description: "Helm plugin for generating values.schema.json from multiple values files."
ignoreFlags: false
Expand Down

0 comments on commit 579e4e0

Please sign in to comment.