Add validation in crds to avoid unrelated schema #19
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 Chart | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'charts/**' | |
| pull_request: | |
| paths: | |
| - 'charts/**' | |
| jobs: | |
| lint: | |
| name: Lint Helm Chart | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: v3.14.0 | |
| - name: Lint chart | |
| run: helm lint charts/gobackup-operator | |
| - name: Template chart | |
| run: helm template gobackup-operator charts/gobackup-operator --debug | |
| release: | |
| name: Release Helm Chart | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| - name: Install Helm | |
| uses: azure/setup-helm@v4 | |
| with: | |
| version: v3.14.0 | |
| - name: Get chart version | |
| id: chart | |
| run: | | |
| VERSION=$(grep '^version:' charts/gobackup-operator/Chart.yaml | awk '{print $2}') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Chart version: $VERSION" | |
| - name: Package Helm chart | |
| run: | | |
| helm package charts/gobackup-operator --destination .cr-release-packages | |
| - name: Create GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| RELEASE_NAME="v${{ steps.chart.outputs.version }}" | |
| TAG_NAME="v${{ steps.chart.outputs.version }}" | |
| CHART_PACKAGE=".cr-release-packages/gobackup-operator-${{ steps.chart.outputs.version }}.tgz" | |
| # Check if release already exists | |
| if gh release view "$TAG_NAME" &>/dev/null; then | |
| echo "Release $TAG_NAME already exists, skipping..." | |
| else | |
| gh release create "$TAG_NAME" "$CHART_PACKAGE" \ | |
| --title "$RELEASE_NAME" \ | |
| --notes "Helm chart for GoBackup Operator v${{ steps.chart.outputs.version }}" | |
| fi | |
| - name: Update Helm repo index | |
| run: | | |
| # Checkout gh-pages branch | |
| git fetch origin gh-pages:gh-pages || true | |
| git checkout gh-pages || git checkout --orphan gh-pages | |
| # Download existing index if it exists | |
| if [ -f index.yaml ]; then | |
| helm repo index .cr-release-packages --url https://github.com/gobackup/gobackup-operator/releases/download/v${{ steps.chart.outputs.version }} --merge index.yaml | |
| else | |
| helm repo index .cr-release-packages --url https://github.com/gobackup/gobackup-operator/releases/download/v${{ steps.chart.outputs.version }} | |
| fi | |
| cp .cr-release-packages/index.yaml . | |
| git add index.yaml | |
| git commit -m "Update Helm repo index for v${{ steps.chart.outputs.version }}" || true | |
| git push origin gh-pages || true | |