name: Pull Request Workflow for Helm Chart changes on: pull_request: branches: - master - 'v**' paths: - 'deployments/kubernetes/chart/reloader/**' env: DOCKER_FILE_PATH: Dockerfile DOCKER_UBI_FILE_PATH: Dockerfile.ubi KUBERNETES_VERSION: "1.30.0" KIND_VERSION: "0.23.0" REGISTRY: ghcr.io # Default to no GITHUB_TOKEN permissions; each job opts into the minimum it needs. permissions: {} jobs: helm-chart-validation: permissions: contents: read runs-on: ubuntu-latest name: Helm Chart Validation steps: - name: Check out code uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 with: ref: ${{github.event.pull_request.head.sha}} fetch-depth: 0 # Setting up helm binary - name: Set up Helm uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4 with: version: v3.20.2 - name: Helm chart unit tests uses: d3adb5/helm-unittest-action@850bc76597579183998069830d5fa8c3ef0ea34a # v2 with: charts: deployments/kubernetes/chart/reloader helm-version: v3.20.2 github-token: ${{ secrets.GITHUB_TOKEN }} helm-version-validation: needs: helm-chart-validation permissions: contents: read runs-on: ubuntu-latest name: Helm Version Validation if: ${{ contains(github.event.pull_request.labels.*.name, 'release/helm-chart') }} steps: - name: Check out code uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 with: ref: ${{github.event.pull_request.head.sha}} fetch-depth: 0 - name: Add Stakater Helm Repo run: | helm repo add stakater https://stakater.github.io/stakater-charts - name: Get version for chart from helm repo id: chart_eval run: | current_chart_version=$(helm search repo stakater/reloader-v2 | tail -n 1 | awk '{print $2}') echo "CURRENT_CHART_VERSION=$(echo ${current_chart_version})" >> $GITHUB_OUTPUT - name: Get Updated Chart version from Chart.yaml uses: mikefarah/yq@751d8ad57b84f1794661bc70c0afb92a22ad7b3c # v4.53.2 id: new_chart_version with: cmd: yq e '.version' deployments/kubernetes/chart/reloader/Chart.yaml # Skip the version-increase gate on first publish, when no reloader-v2 # chart exists yet in the repo (CURRENT_CHART_VERSION is empty). - name: Check Version if: steps.chart_eval.outputs.CURRENT_CHART_VERSION != '' uses: aleoyakas/check-semver-increased-action@415c9c60054c2442c03478b6dd96a195deac6695 # v1 id: check-version with: current-version: ${{ steps.new_chart_version.outputs.result }} previous-version: ${{ steps.chart_eval.outputs.CURRENT_CHART_VERSION }} - name: Fail if Helm Chart version isnt updated if: steps.chart_eval.outputs.CURRENT_CHART_VERSION != '' && steps.check-version.outputs.is-version-increased != 'true' run: | echo "Helm Chart Version wasnt updated" exit 1