Skip to content

Bot: Automated Helm Chart Bump #117

Bot: Automated Helm Chart Bump

Bot: Automated Helm Chart Bump #117

Workflow file for this run

name: Chart Release
on:
push:
branches:
- main
paths:
- charts/**
jobs:
chart-test:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.list-changed.outputs.changed }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.10.0
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.3.1
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
- name: Create kind cluster
uses: helm/kind-action@v1.4.0
if: steps.list-changed.outputs.changed == 'true'
- name: Run chart-testing (install)
if: steps.list-changed.outputs.changed == 'true'
run: ct install
bump-version:
runs-on: ubuntu-latest
needs: chart-test
outputs:
newVer: ${{ steps.new_helm_version.outputs.new_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure yq
uses: mikefarah/yq@v4.30.1
- name: Get Current Helm Chart Version
id: helm_version
run: |
echo "helmVer=$(yq '.version' charts/version-notifier/Chart.yaml)" >> $GITHUB_OUTPUT
- name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ steps.helm_version.outputs.helmVer }}
- name: Set Level
id: set_level
run: |
if [ $((${{ steps.semver_parser.outputs.patch }})) -lt $((9)) ]; then
echo "level=patch" >> $GITHUB_OUTPUT
else
echo "level=minor" >> $GITHUB_OUTPUT
fi
- name: Bump Version
uses: actions-ecosystem/action-bump-semver@v1
id: new_helm_version
with:
current_version: ${{ steps.helm_version.outputs.helmVer }}
level: ${{ steps.set_level.outputs.level }}
release:
runs-on: ubuntu-latest
needs: bump-version
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Edit version attributes of the helm chart
run: |
yq -i '.version = "${{ needs.bump-version.outputs.newVer }}"' charts/version-notifier/Chart.yaml
- name: Commit Helm Chart
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@gmail.com"
git commit -am "Bot: Automated Helm Chart Bump"
- name: Push Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.4.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"