Created
November 14, 2017 19:42
-
-
Save notxcain/7f5c9c4ef6d516337b26d33a221fc3bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| working_dir="$( cd "$1" && pwd )" | |
| chart_name=$(basename $(pwd)) | |
| unamestr=$(uname) | |
| if [[ "$unamestr" == 'Darwin' ]]; then | |
| sha='shasum' | |
| elif [[ "$unamestr" == 'Linux' ]]; then | |
| sha='sha1sum' | |
| fi | |
| current_hashsum=$(find $working_dir -type f | sort -z | xargs echo | xargs cat | $sha | awk '{ print $1 }') | |
| latest_hashsum=$(helm inspect evotor/$chart_name | grep appVersion | awk '{ print $2 }') | |
| echo "Current hashsum: $current_hashsum" | |
| echo "Latest hashsum: $latest_hashsum" | |
| if [[ "$current_hashsum" != "$latest_hashsum" ]]; then | |
| latest_version=$(helm inspect evotor/$chart_name | grep version | awk '{ print $2 }') | |
| next_version=$(echo $latest_version | awk -F. '{ print $1"."$2+1"."$3; }') | |
| cp Chart.yaml Chart.yaml.bak | |
| echo " " | |
| echo "Before:" | |
| cat Chart.yaml | |
| sed -e "s/version.*/version: $next_version/" Chart.yaml.bak > Chart.yaml | |
| echo "appVersion: $current_hashsum" >> Chart.yaml | |
| echo " " | |
| echo "After:" | |
| cat Chart.yaml | |
| helm package . | |
| rm Chart.yaml | |
| mv Chart.yaml.bak Chart.yaml | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment