Skip to content

Commit

Permalink
Merge pull request #16 from foomo/dadav-helm-schema
Browse files Browse the repository at this point in the history
fix(dadav/helm-schema): add
  • Loading branch information
franklinkim authored Oct 16, 2024
2 parents 4ae38ab + 7440d5d commit ff6f700
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dadav/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Dadav

## helm-schema ([releases](https://github.com/dadav/helm-schema/releases))

```yaml
ownbrew:
packages:
- name: helm-schema
tap: foomo/tap/dadav/helm-schema
version: 0.14.1
```
57 changes: 57 additions & 0 deletions dadav/helm-schema.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

set -e

# colors
CRed='\033[1;31m'
CGray='\033[0;37m'
CGreen='\033[1;32m'
CYellow='\033[1;33m'
NC='\033[0m'

# logging
info() {
echo -e "${CGray}${1}${NC}"
}

warn() {
echo -e "${CYellow}${1}${NC}"
}

error() {
echo -e "${CRed}${1}${NC}"
}

success() {
echo -e "${CGreen}${1}${NC}"
}

# vars
os="${os:-${1}}"
arch="${arch:-${2}}"
version="${version:-${3}}"

case $os in
linux) os_alias="Linux";;
darwin) os_alias="Darwin";;
esac

case $arch in
amd64) arch_alias="x86_64";;
arm64) arch_alias="arm64";;
esac

info "downloading ..."
curl -fL "https://github.com/dadav/helm-schema/releases/download/${version}/helm-schema_${version}_${os_alias}_${arch_alias}.tar.gz" -o "${TEMP_DIR}/helm-schema.tar.gz"
curl -fL "https://github.com/dadav/helm-schema/releases/download/${version}/checksums.txt" -o "${TEMP_DIR}/helm-schema.tar.gz.sha256"

info "validating ..."
echo "$(cat "${TEMP_DIR}/helm-schema.tar.gz.sha256" | grep "helm-schema_${version}_${os_alias}_${arch_alias}.tar.gz" | awk '{print $1;}') ${TEMP_DIR}/helm-schema.tar.gz" | shasum -a 256 --check --quiet

info "extracting ..."
tar -xzvf "${TEMP_DIR}/helm-schema.tar.gz" -C "${TEMP_DIR}" helm-schema
mv -f "${TEMP_DIR}/helm-schema" "${BIN_DIR}/helm-schema-${version}-${os}-${arch}"
chmod a+x "${BIN_DIR}/helm-schema-${version}-${os}-${arch}"

info "cleanup ..."
rm "${TEMP_DIR}/helm-schema.tar.gz" "${TEMP_DIR}/helm-schema.tar.gz.sha256"
5 changes: 5 additions & 0 deletions dadav/helm-schema_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

source .include/test.sh

test "$(dirname $0)/helm-schema.sh" "0.14.1"

0 comments on commit ff6f700

Please sign in to comment.