last commit for sure #108
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: Bump Chart Dependencies | |
on: {} | |
jobs: | |
bump-local-dependencies: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: spotinst/charts | |
- uses: gabe565/[email protected] | |
- uses: azure/[email protected] | |
with: | |
version: v3.12.1 | |
- name: Check Dependencies Versions | |
id: check-dependencies | |
run: | | |
for chart in `yq '.dependencies[].name' ./charts/${{ inputs.chart-name }}/Chart.yaml`; do | |
if [ ! -f ./charts/${chart}/Chart.yaml ]; then | |
continue | |
fi | |
dep_version=$(yq '.dependencies[] | select(.name == "'${chart}'") | .version' ./charts/${{ inputs.chart-name }}/Chart.yaml) | |
chart_version=$(yq '.version' ./charts/${chart}/Chart.yaml) | |
if [ "${dep_version}" == "${chart_version}" ]; then | |
echo "Dependency \"${chart}\" has version \"${dep_version}\" and is up to date" | |
continue | |
fi | |
echo "Dependency \"${chart}\" has version \"${dep_version}\" but should be \"${chart_version}\", bumping to \"${chart_version}\"" | |
yq -i '(.dependencies[] | select(.name == "'${chart}'") | .version) = "'${chart_version}'"' ./charts/${{ inputs.chart-name }}/Chart.yaml | |
done | |
- name: Check Diff | |
id: check-diff | |
run: | | |
(git diff --exit-code && echo "Nothing to do" && echo "should_update=false" >> $GITHUB_OUTPUT) || (echo "Changes detected" && echo "should_update=true" >> $GITHUB_OUTPUT) | |
- name: Update Chart Version | |
if: steps.check-diff.outputs.should_update == 'true' | |
run: | | |
yq -i '.version |= (split(".") | .[-1] |= ((. tag = "!!int") + 1) | join("."))' ./charts/${{ inputs.chart-name }}/Chart.yaml | |
- name: Update Dependencies | |
if: steps.check-diff.outputs.should_update == 'true' | |
run: | | |
helm dependency update ./charts/${{ inputs.chart-name }} | |
- name: Update helm docs | |
if: steps.check-diff.outputs.should_update == 'true' | |
run: | | |
helm-docs --chart-to-generate charts/${{ inputs.chart-name }} | |
- name: Generate version bump commit | |
if: steps.check-diff.outputs.should_update == 'true' | |
run: | | |
git config user.name ${{ github.actor }} | |
git config user.email '${{ github.actor }}@users.noreply.github.com' | |
git add . | |
git commit -a -m "bump ${{ inputs.chart-name }} dependencies" | |
- name: Create Pull Request | |
if: steps.check-diff.outputs.should_update == 'true' | |
id: cpr | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: '[bump] ${{ inputs.chart-name }} dependencies' | |
branch: bump/dependencies-for-${{ inputs.chart-name }} | |
delete-branch: true | |
labels: bump_dependencies |