From 46aadb26e8074f7b3d552c7f7708cbfaa738f5ac Mon Sep 17 00:00:00 2001 From: YannikBramkamp <74957914+YannikBramkamp@users.noreply.github.com> Date: Fri, 2 Jul 2021 14:46:34 +0200 Subject: [PATCH] Use mittwald bump-version action to publish to our chart museum (#46) * use mittwald-chart-bump action * remove old script --- .github/workflows/workflow.yml | 10 ++++-- scripts/bump-app-version.sh | 66 ---------------------------------- 2 files changed, 8 insertions(+), 68 deletions(-) delete mode 100755 scripts/bump-app-version.sh diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 94f68966..4cc5f00b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -131,5 +131,11 @@ jobs: - name: Push images run: docker push "$IMAGE_NAME:latest" && docker push "$IMAGE_NAME:${GITHUB_REF##*/}" - - name: Bump Chart Version - run: bash ./scripts/bump-app-version.sh publish "${GITHUB_REF##*/}" "${{ secrets.githubToken }}" + - name: Run chart version bump + uses: mittwald/bump-app-version-action@v1 + with: + mode: 'publish' + chartYaml: './deploy/helm-chart/kubernetes-secret-generator/Chart.yaml' + env: + GITHUB_TOKEN: "${{ secrets.RELEASE_USER_TOKEN }}" + HELM_REPO_PASSWORD: "${{ secrets.HELM_REPO_PASSWORD }}" diff --git a/scripts/bump-app-version.sh b/scripts/bump-app-version.sh deleted file mode 100755 index 8cb78ad5..00000000 --- a/scripts/bump-app-version.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash - -set -e - -## debug if desired -if [[ -n "${DEBUG}" ]]; then - set -x -fi - -## make this script a bit more re-usable -GIT_REPOSITORY="github.com/mittwald/kubernetes-secret-generator.git" -CHART_YAML="./deploy/helm-chart/kubernetes-secret-generator/Chart.yaml" - -## avoid noisy shellcheck warnings -MODE="${1}" -TAG="${2:-v0.0.0}" -GITHUB_TOKEN="${3:-dummy}" - -## temp working vars -TIMESTAMP="$(date +%s )" -TMP_DIR="/tmp/${TIMESTAMP}" - -## set up Git-User -git config --global user.name "Mittwald Machine" -git config --global user.email "opensource@mittwald.de" - -## temporary clone git repository -git clone "https://${GIT_REPOSITORY}" "${TMP_DIR}" -cd "${TMP_DIR}" - -## replace appVersion -sed -i "s#appVersion:.*#appVersion: ${TAG}#g" "${CHART_YAML}" - -## replace chart version with current tag without 'v'-prefix -sed -i "s#version:.*#version: ${TAG/v/}#g" "${CHART_YAML}" - -## useful for debugging purposes -git status - -## Add new remote with credentials baked in url -git remote add publisher "https://mittwald-machine:${GITHUB_TOKEN}@${GIT_REPOSITORY}" - -## add and commit changed file -git add -A - -## useful for debugging purposes -git status - -## stage changes -git commit -m "Bump appVersion to '${TAG}' and version to '${TAG/v/}'" - -## rebase -git pull --rebase publisher master - -if [[ "$MODE" == "publish" ]]; then - - ## publish changes - git push publisher master - - ## trigger helm-charts reload - curl -X POST 'https://api.github.com/repos/mittwald/helm-charts/dispatches' -u "mittwald-machine:${GITHUB_TOKEN}" -d '{"event_type": "updateCharts"}' - -fi - - -exit 0