From fb183d897b615f82d82908bf2f5c6fe43b5a8b08 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Tue, 6 Aug 2019 16:14:07 +0300 Subject: [PATCH] Publish Helm chart to GH Pages --- .circleci/config.yml | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..6ffce68 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,51 @@ +version: 2.1 +jobs: + push-helm-charts: + docker: + - image: circleci/golang:1.12 + steps: + - checkout + - run: + name: Install kubectl + command: sudo curl -L https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && sudo chmod +x /usr/local/bin/kubectl + - run: + name: Install helm + command: sudo curl -L https://storage.googleapis.com/kubernetes-helm/helm-v2.14.2-linux-amd64.tar.gz | tar xz && sudo mv linux-amd64/helm /bin/helm && sudo rm -rf linux-amd64 + - run: + name: Initialize helm + command: helm init --client-only --kubeconfig=$HOME/.kube/kubeconfig + - run: + name: Lint charts + command: | + helm lint ./charts/* + - run: + name: Package charts + command: | + mkdir $HOME/charts + helm package ./charts/* --destination $HOME/charts + - run: + name: Publish charts + command: | + if echo "${CIRCLE_TAG}" | grep -Eq "[0-9]+(\.[0-9]+)*(-[a-z]+)?$"; then + REPOSITORY="https://stefanprodan:${GITHUB_TOKEN}@github.com/stefanprodan/podinfo.git" + git config user.email stefanprodan@users.noreply.github.com + git config user.name stefanprodan + git remote set-url origin ${REPOSITORY} + git checkout gh-pages + mv -f $HOME/charts/*.tgz . + helm repo index . --url https://stefanprodan.github.io/podinfo + git add . + git commit -m "Publish Helm charts v${CIRCLE_TAG}" + git push origin gh-pages + else + echo "Not a release! Skip charts publish" + fi + + release: + jobs: + - push-helm-charts: + filters: + branches: + ignore: /.*/ + tags: + ignore: /^chart.*/ \ No newline at end of file