feat: update CRDs and appVersion to version snapshot-feat-non-enterpr… #98
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: Release | |
| on: | |
| push: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| issues: write | |
| pull-requests: write | |
| env: | |
| REGISTRY: ghcr.io | |
| CHART_NAME: ${{ github.repository }} | |
| jobs: | |
| release: | |
| name: Release Chart | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Lowercase chart name | |
| run: echo "CHART_NAME=${CHART_NAME,,}" >> "$GITHUB_ENV" | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v5 | |
| - name: Log in to GitHub Container Registry | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login "${{ env.REGISTRY }}" --username "${{ github.actor }}" --password-stdin | |
| - name: Setup Node.js | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| - name: Install semantic-release plugins | |
| if: github.ref == 'refs/heads/main' | |
| run: npm ci | |
| - name: Get latest tag before release | |
| id: before | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| git fetch --tags | |
| echo "tag=$(git tag --sort=-v:refname | head -1)" >> "$GITHUB_OUTPUT" | |
| - name: Run semantic-release | |
| id: semantic | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npx semantic-release | |
| - name: Detect new release | |
| id: release | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| git fetch --tags | |
| LATEST_TAG=$(git tag --sort=-v:refname | head -1) | |
| if [[ "$LATEST_TAG" != "${{ steps.before.outputs.tag }}" ]]; then | |
| VERSION="${LATEST_TAG#v}" | |
| echo "new_release_published=true" >> "$GITHUB_OUTPUT" | |
| echo "new_release_version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "new_release_published=false" >> "$GITHUB_OUTPUT" | |
| echo "new_release_version=" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Determine chart version | |
| id: version | |
| run: | | |
| if [[ "${{ github.ref_name }}" == "main" && "${{ steps.release.outputs.new_release_published }}" == "true" ]]; then | |
| echo "version=${{ steps.release.outputs.new_release_version }}" >> "$GITHUB_OUTPUT" | |
| elif [[ "${{ github.ref_name }}" == "main" ]]; then | |
| SHORT_SHA="$(git rev-parse --short HEAD)" | |
| echo "version=0.0.0-main.${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| else | |
| BRANCH="$(echo '${{ github.ref_name }}' | sed 's|[^a-zA-Z0-9._-]|-|g' | cut -c1-50)" | |
| SHORT_SHA="$(git rev-parse --short HEAD)" | |
| echo "version=0.0.0-snapshot.${BRANCH}.${SHORT_SHA}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Update Chart.yaml version | |
| run: | | |
| sed -i "s/^version:.*/version: ${{ steps.version.outputs.version }}/" Chart.yaml | |
| - name: Package Helm chart | |
| run: helm package . | |
| - name: Push chart to GHCR | |
| run: helm push *.tgz "oci://${{ env.REGISTRY }}/${{ env.CHART_NAME }}" | |