Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't build goarch 386 #4

Merged
merged 3 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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