Merge pull request #1 from helmcode/svc-lb #4
This file contains hidden or 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: Helm Charts | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| REGISTRY: ghcr.io | |
| REGISTRY_PATH: ghcr.io/helmcode/helm-charts | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Lint charts | |
| run: | | |
| for chart in charts/*/; do | |
| if [ -f "$chart/Chart.yaml" ]; then | |
| echo "Linting $chart..." | |
| helm lint "$chart" | |
| fi | |
| done | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Package charts | |
| run: | | |
| mkdir -p packages | |
| for chart in charts/*/; do | |
| if [ -f "$chart/Chart.yaml" ]; then | |
| echo "Packaging $chart..." | |
| helm package "$chart" -d packages/ | |
| fi | |
| done | |
| - name: Upload packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: helm-packages | |
| path: packages/ | |
| retention-days: 1 | |
| publish: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: helm-packages | |
| path: packages/ | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Login to GHCR | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin | |
| - name: Push charts to GHCR | |
| run: | | |
| for file in packages/*.tgz; do | |
| echo "Pushing $file..." | |
| helm push "$file" oci://${{ env.REGISTRY_PATH }} | |
| done |