Skip to content

Commit

Permalink
auto bump chart version
Browse files Browse the repository at this point in the history
  • Loading branch information
garethahealy committed Nov 22, 2023
1 parent 4fc1dbd commit 9dbedb4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 6 deletions.
19 changes: 19 additions & 0 deletions .github/renovate-bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

CHARTS_CHANGED=()
changed=$(ct list-changed)
for chart in ${changed}; do
echo "Chart has changes: ${chart}"

hasVersionBumped=$(git --no-pager diff "${chart}/Chart.yaml" | grep "+version" | wc -l)
if [[ "${hasVersionBumped}" -eq 0 ]]; then
echo "-> Version has not been bumped. Bumping to:"
pybump bump --file "${chart}/Chart.yaml" --level patch

CHARTS_CHANGED+=("${chart}/Chart.yaml")
fi

echo
done

echo "CHARTS=$(echo ${CHARTS_CHANGED[*]})" >> $GITHUB_OUTPUT
4 changes: 2 additions & 2 deletions .github/workflows/install-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
- name: Setup Helm 🧰
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
with:
version: v3.5.1
version: v3.13.0

- name: Setup Python 🐍
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
with:
python-version: 3.7
python-version: 3.11

- name: Setup chart-testing 🧰
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
Expand Down
34 changes: 32 additions & 2 deletions .github/workflows/lint-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ concurrency:

jobs:
lint-test:
env:
branch_name: ${{ github.head_ref || github.ref_name }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
Expand All @@ -22,15 +24,43 @@ jobs:
- name: Setup Helm 🧰
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
with:
version: v3.5.1
version: v3.13.0

- name: Setup Python 🐍
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4
with:
python-version: 3.7
python-version: 3.11

- name: Setup chart-testing 🧰
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1

- name: Setup pybump
if: ${{ contains(env.branch_name, 'renovate') }}
run: |
pip3 install pybump
- name: Bump chart version
if: ${{ contains(env.branch_name, 'renovate') }}
id: bumped_charts
run: |
.github/renovate-bump.sh
- name: Run Chart lint tests 🧪
run: ct lint

# Use the REST API to commit changes, so we get automatic commit signing
- name: Push changes
if: ${{ contains(env.branch_name, 'renovate') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
changed_charts: ${{ steps.bumped_charts.outputs.CHARTS }}
run: |
for chart in ${changed_charts}; do
export SHA=$(git rev-parse origin/${branch_name}:${chart} )
gh api --method PUT /repos/:owner/:repo/contents/${chart} \
--field message="chore: bumped ${chart} version" \
--field content=@<( base64 -i ${chart} ) \
--field branch="${branch_name}" \
--field sha="$SHA"
done
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: latest
version: v3.13.0

- name: Add dependency chart repos
run: |
Expand Down
3 changes: 2 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"extends": [
"config:best-practices",
"schedule:earlyMondays"
]
],
"bumpVersion": "patch"
}

0 comments on commit 9dbedb4

Please sign in to comment.