|
| 1 | +name: Lint, Test and Deploy Charts |
| 2 | +on: |
| 3 | + push: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +jobs: |
| 7 | + lint-test: |
| 8 | + name: "Lint and Test" |
| 9 | + runs-on: ubuntu-22.04 |
| 10 | + if: github.ref != 'refs/heads/main' |
| 11 | + steps: |
| 12 | + - name: "Checkout" |
| 13 | + uses: actions/checkout@v2.4.2 |
| 14 | + with: |
| 15 | + fetch-depth: 0 |
| 16 | + |
| 17 | + - name: "Set Up Helm" |
| 18 | + uses: azure/setup-helm@v3.3 |
| 19 | + if: github.ref != 'refs/heads/main' |
| 20 | + with: |
| 21 | + version: v3.4.1 |
| 22 | + |
| 23 | + - name: "Set Up Python" |
| 24 | + uses: actions/setup-python@v4.2.0 |
| 25 | + if: github.ref != 'refs/heads/main' |
| 26 | + with: |
| 27 | + python-version: 3.9 |
| 28 | + |
| 29 | + - name: "Set up chart-testing" |
| 30 | + uses: helm/chart-testing-action@v2.3.0 |
| 31 | + if: github.ref != 'refs/heads/main' |
| 32 | + with: |
| 33 | + version: v3.3.0 |
| 34 | + |
| 35 | + - name: "Run chart-testing (list-changed)" |
| 36 | + id: list-changed |
| 37 | + if: github.ref != 'refs/heads/main' |
| 38 | + run: | |
| 39 | + changed=$(ct list-changed --config ct.yaml) |
| 40 | + if [[ -n "$changed" ]]; then |
| 41 | + echo "::set-output name=changed::true" |
| 42 | + fi |
| 43 | +
|
| 44 | + - name: "Run chart-testing (lint)" |
| 45 | + run: ct lint --config ct.yaml |
| 46 | + if: steps.list-changed.outputs.changed == 'true' && github.ref != 'refs/heads/main' |
| 47 | + |
| 48 | + - name: Create kind cluster |
| 49 | + uses: helm/kind-action@v1.4.0 |
| 50 | + if: steps.list-changed.outputs.changed == 'true' && github.ref != 'refs/heads/main' |
| 51 | + |
| 52 | + - name: Run chart-testing (install) |
| 53 | + run: ct install --config ct.yaml |
| 54 | + if: steps.list-changed.outputs.changed == 'true' && github.ref != 'refs/heads/main' |
| 55 | + |
| 56 | + release: |
| 57 | + runs-on: ubuntu-latest |
| 58 | + if: github.ref == 'refs/heads/main' |
| 59 | + needs: |
| 60 | + - lint-test |
| 61 | + name: "Release Chart on GH" |
| 62 | + steps: |
| 63 | + - name: Checkout |
| 64 | + uses: actions/checkout@v2 |
| 65 | + with: |
| 66 | + fetch-depth: 0 |
| 67 | + |
| 68 | + - name: Configure Git |
| 69 | + run: | |
| 70 | + git config user.name "$GITHUB_ACTOR" |
| 71 | + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" |
| 72 | +
|
| 73 | + - name: Install Helm |
| 74 | + uses: azure/setup-helm@v1 |
| 75 | + with: |
| 76 | + version: v3.4.0 |
| 77 | + |
| 78 | + - name: Run chart-releaser |
| 79 | + uses: helm/chart-releaser-action@v1.0.0 |
| 80 | + env: |
| 81 | + CR_TOKEN: '${{ secrets.CR_TOKEN }}' |
0 commit comments