diff --git a/.github/workflows/chart-lint-test.yaml b/.github/workflows/chart-lint-test.yaml new file mode 100644 index 0000000000..e3cf8ce07f --- /dev/null +++ b/.github/workflows/chart-lint-test.yaml @@ -0,0 +1,47 @@ +name: Lint and Test Charts + +on: + pull_request: + push: + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v4.2.0 + with: + version: v3.14.4 + + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + check-latest: true + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.7.0 + + - 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 "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Run chart-testing (lint) + if: steps.list-changed.outputs.changed == 'true' + run: ct lint --target-branch ${{ github.event.repository.default_branch }} + + - name: Create kind cluster + if: steps.list-changed.outputs.changed == 'true' + uses: helm/kind-action@v1.10.0 + + - name: Run chart-testing (install) + if: steps.list-changed.outputs.changed == 'true' + run: ct install --target-branch ${{ github.event.repository.default_branch }} diff --git a/.github/workflows/releases-charts.yaml b/.github/workflows/releases-charts.yaml index 8bb0a20e30..3ed3bc2428 100644 --- a/.github/workflows/releases-charts.yaml +++ b/.github/workflows/releases-charts.yaml @@ -2,8 +2,8 @@ name: Releases Charts on: push: -# branches: -# - release-* + # branches: + # - release-* paths: - charts/kwok/Chart.yaml - charts/stage-fast/Chart.yaml @@ -23,22 +23,22 @@ jobs: - name: Install Helm uses: azure/setup-helm@v4 -# - name: Login to GitHub Container Registry -# run: | -# helm registry login --username ${GITHUB_ACTOR} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io -# - name: Release oci charts to ghcr.io -# env: -# IMAGE_PREFIX: ghcr.io/${{ github.repository }} -# run: | -# make oci-charts - - name: Set up Git user + # - name: Login to GitHub Container Registry + # run: | + # helm registry login --username ${GITHUB_ACTOR} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io + # - name: Release oci charts to ghcr.io + # env: + # IMAGE_PREFIX: ghcr.io/${{ github.repository }} + # run: | + # make oci-charts + run: | git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Release charts uses: helm/chart-releaser-action@v1.6.0 -# if: ${{ env.PUSH == 'true' }} + # if: ${{ env.PUSH == 'true' }} env: CR_RELEASE_NAME_TEMPLATE: "{{ .Name }}-helm-chart-{{ .Version }}" CR_MAKE_RELEASE_LATEST: false @@ -54,5 +54,5 @@ jobs: if [ -z "${pkg:-}" ]; then break fi - helm push "${pkg}" oci://ghcr.io/${{ github.repository }} + helm push "${pkg}" oci://ghcr.io/${{ github.repository }}/charts done