[kube-prometheus-stack] upgrade CRDs using helm #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Renovate Bump Chart Version | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'charts/**/*' | |
jobs: | |
renovate-bump-chart-version: | |
name: Renovate Bump Chart Version | |
runs-on: ubuntu-latest | |
if: github.actor == 'renovate[bot]' | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 | |
with: | |
python-version: '3.11' | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1 | |
- name: Detect changed charts | |
id: list-changed | |
run: | | |
changed="$(ct list-changed --config .github/linters/ct.yaml)" | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> "$GITHUB_OUTPUT" | |
echo "changed_list=${changed//$'\n'/ }" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Bump chart version | |
if: steps.list-changed.outputs.changed == 'true' | |
env: | |
CHART: ${{ steps.list-changed.outputs.changed_list }} | |
run: | | |
if [[ $CHANGED_LIST == *" "* ]]; then | |
echo "Multiple charts changed, skipping bumping chart version" | |
exit 0 | |
fi | |
CHART_VERSION=$(grep -e "^version:" "$CHART/Chart.yaml" | cut -d ":" -f 2 | tr -d '[:space:]' | tr -d '"') | |
CHART_MAJOR_VERSION=$(printf '%s' "$CHART_VERSION" | cut -d "." -f 1) | |
CHART_MINOR_VERSION=$(printf '%s' "$CHART_VERSION" | cut -d "." -f 2) | |
CHART_MINOR_VERSION=$((CHART_MINOR_VERSION+1)) | |
CHART_NEW_VERSION="${CHART_MAJOR_VERSION}.${CHART_MINOR_VERSION}.0" | |
sed -i "s/^version:.*/version: \"${CHART_NEW_VERSION}\"/" "$CHART/Chart.yaml" | |
- name: Commit changes | |
if: steps.list-changed.outputs.changed == 'true' | |
env: | |
CHART: ${{ steps.list-changed.outputs.changed_list }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_HEAD_REF: ${{ github.head_ref }} | |
run: | | |
curl https://api.github.com/graphql -f \ | |
-sSf -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
--data @- <<GRAPHQL | jq | |
{ | |
"query": "mutation (\$input: CreateCommitOnBranchInput!) { | |
createCommitOnBranch(input: \$input) { | |
commit { | |
url | |
} | |
} | |
}", | |
"variables": { | |
"input": { | |
"branch": { | |
"repositoryNameWithOwner": "${{ github.repository }}", | |
"branchName": "$GITHUB_HEAD_REF" | |
}, | |
"message": { "headline": "Update Chart.yaml" }, | |
"fileChanges": { | |
"additions": [ | |
{ | |
"path": "$CHART/Chart.yaml", | |
"contents": "$(base64 -w 0 <"$CHART/Chart.yaml")" | |
} | |
] | |
}, | |
"expectedHeadOid": "${{ github.sha }}" | |
} | |
} | |
} | |
GRAPHQL |