Last active
May 2, 2019 22:27
-
-
Save anmolnagpal/6a54510d6bb03cf0a18766b10bc0e9ff to your computer and use it in GitHub Desktop.
Revisions
-
anmolnagpal revised this gist
May 2, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -71,4 +71,4 @@ git add . git status git commit -m "Published by CircleCI $CIRCLE_BUILD_URL" git push origin git push origin "$GITHUB_PAGES_BRANCH" -
anmolnagpal revised this gist
May 2, 2019 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -70,4 +70,5 @@ git config user.name CircleCI git add . git status git commit -m "Published by CircleCI $CIRCLE_BUILD_URL" git push origin git push -q https://${GITHUB_TOKEN}@github.com/anmolnagpal/helmregistry.git "$GITHUB_PAGES_BRANCH" -
anmolnagpal revised this gist
May 2, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,13 +8,13 @@ WORKING_DIRECTORY="$PWD" echo "ERROR: Environment variable GITHUB_PAGES_REPO is required" exit 1 } [ -z "$GITHUB_PAGES_BRANCH" ] && GITHUB_PAGES_BRANCH=master [ -z "$HELM_CHARTS_SOURCE" ] && HELM_CHARTS_SOURCE="$WORKING_DIRECTORY/charts" [ -d "$HELM_CHARTS_SOURCE" ] || { echo "ERROR: Could not find Helm charts in $HELM_CHARTS_SOURCE" exit 1 } [ -z "$HELM_VERSION" ] && HELM_VERSION=2.13.1 [ "$CIRCLE_BRANCH" ] || { echo "ERROR: Environment variable CIRCLE_BRANCH is required" exit 1 -
anmolnagpal created this gist
May 2, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,73 @@ #!/bin/sh set -e set -o pipefail WORKING_DIRECTORY="$PWD" [ "$GITHUB_PAGES_REPO" ] || { echo "ERROR: Environment variable GITHUB_PAGES_REPO is required" exit 1 } [ -z "$GITHUB_PAGES_BRANCH" ] && GITHUB_PAGES_BRANCH=gh-pages [ -z "$HELM_CHARTS_SOURCE" ] && HELM_CHARTS_SOURCE="$WORKING_DIRECTORY/charts" [ -d "$HELM_CHARTS_SOURCE" ] || { echo "ERROR: Could not find Helm charts in $HELM_CHARTS_SOURCE" exit 1 } [ -z "$HELM_VERSION" ] && HELM_VERSION=2.8.1 [ "$CIRCLE_BRANCH" ] || { echo "ERROR: Environment variable CIRCLE_BRANCH is required" exit 1 } echo "GITHUB_PAGES_REPO=$GITHUB_PAGES_REPO" echo "GITHUB_PAGES_BRANCH=$GITHUB_PAGES_BRANCH" echo "HELM_CHARTS_SOURCE=$HELM_CHARTS_SOURCE" echo "HELM_VERSION=$HELM_VERSION" echo "CIRCLE_BRANCH=$CIRCLE_BRANCH" echo '>> Prepare...' mkdir -p /tmp/helm/bin mkdir -p /tmp/helm/publish apk update apk add ca-certificates git openssh echo '>> Installing Helm...' cd /tmp/helm/bin wget "https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz" tar -zxf "helm-v${HELM_VERSION}-linux-amd64.tar.gz" chmod +x linux-amd64/helm alias helm=/tmp/helm/bin/linux-amd64/helm helm version -c helm init -c echo ">> Checking out $GITHUB_PAGES_BRANCH branch from $GITHUB_PAGES_REPO" cd /tmp/helm/publish mkdir -p "$HOME/.ssh" ssh-keyscan -H github.com >> "$HOME/.ssh/known_hosts" git clone -b "$GITHUB_PAGES_BRANCH" "[email protected]:$GITHUB_PAGES_REPO.git" . echo '>> Building charts...' find "$HELM_CHARTS_SOURCE" -mindepth 1 -maxdepth 1 -type d | while read chart; do echo ">>> helm lint $chart" helm lint "$chart" chart_name="`basename "$chart"`" echo ">>> helm package -d $chart_name $chart" mkdir -p "$chart_name" helm package -d "$chart_name" "$chart" done echo '>>> helm repo index' helm repo index . if [ "$CIRCLE_BRANCH" != "master" ]; then echo "Current branch is not master and do not publish" exit 0 fi echo ">> Publishing to $GITHUB_PAGES_BRANCH branch of $GITHUB_PAGES_REPO" git config user.email "$CIRCLE_USERNAME@users.noreply.github.com" git config user.name CircleCI git add . git status git commit -m "Published by CircleCI $CIRCLE_BUILD_URL" git push origin "$GITHUB_PAGES_BRANCH"