diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4847c2f..49431ed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,24 +48,30 @@ jobs: docker tag "$IMAGE_NAME:latest" "$REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" docker push "$REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" - - name: Update Helm chart appVersion + - name: Update Helm chart metadata run: | set -euo pipefail sed -i -E "s|^appVersion: .*|appVersion: \"${GITHUB_RUN_NUMBER}\"|" chart/Chart.yaml + sed -i -E "s|^ tag: .*| tag: \"${GITHUB_RUN_NUMBER}\"|" chart/values.yaml + current_version="$(awk '/^version:/ {gsub(/\"/, "", $2); print $2; exit}' chart/Chart.yaml)" + IFS='.' read -r major minor patch <<< "$current_version" + new_version="${major}.${minor}.$((patch + 1))" + sed -i -E "s|^version: .*|version: ${new_version}|" chart/Chart.yaml + echo "Updated appVersion and image tag to ${GITHUB_RUN_NUMBER}, and bumped chart version: ${current_version} -> ${new_version}" - - name: Commit chart appVersion update to master + - name: Commit chart metadata update to master run: | set -euo pipefail git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add chart/Chart.yaml + git add chart/Chart.yaml chart/values.yaml if git diff --cached --quiet; then echo "No changes to commit" exit 0 fi - git commit -m "chore(ci): update chart appVersion to ${GITHUB_RUN_NUMBER} [skip ci]" + git commit -m "chore(ci): update chart metadata [skip ci]" git push origin HEAD:master # - name: Upload manifests artifact