Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Only create helm chart and publish it without creating a release? #168

Open
derTobsch opened this issue Oct 23, 2023 · 2 comments

Comments

@derTobsch
Copy link

Is there a way to only upload the helm chart to GitHub Pages without creating a release and a tag?

@sillock1
Copy link

Is there an answer to this question?

@hegerdes
Copy link

Since chart releaser did not get any relevant updates and is missing some functions like what you want to do, I gave up on chart releaser.

I have a pipeline for a mono repo with charts, dockerfiles and application. The below builds my charts uploads them as a artifact to GA-Actions. It updates the index.ymal in gh-pages. It !!DOES NOT!! upload the chart tgz file to a release. You still have to upload those pipeline artifacts to the release yourself. I do that with the goreleaser by setting release.extra_files[0].glob: ./charts/*.tgz

  chart-release:
    runs-on: ubuntu-latest
    env:
      CHART_BASE_DIR: charts
      GH_PAGES_BRANCH: gh-pages
    permissions:
      contents: write
      pages: write

      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set ENVs
        id: env-setup
        run: |
          echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
          echo "CHART_VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')" >> $GITHUB_OUTPUT
          git config user.name "$GITHUB_ACTOR"
          git config user.email "[email protected]"
      - name: Package Charts
        run: |
          # Package charts
          mkdir -p charts/.ci-build
          echo "Setting chart version to ${{ steps.env-setup.outputs.CHART_VERSION }}"

          for DIR in $CHART_BASE_DIR/*; do
            # Check if Chart.yaml exists in this directory
            if [ -f "${DIR}/Chart.yaml" ]; then
              echo "Packaging ${DIR}"
              helm dependency update $DIR
              helm lint $DIR
              helm package $DIR --version ${{ steps.env-setup.outputs.CHART_VERSION }} --destination charts/.ci-build
            fi
          done
          git fetch --all

      - name: Upload chart artifacts
        uses: actions/upload-artifact@v4
        with:
          name: helm-charts-${{ github.ref_name }}
          path: charts/.ci-build/*
          retention-days: 30

      - name: Publish to GH-Pages
        id: ghpublish
        run: |
          git checkout $GH_PAGES_BRANCH --force
          helm repo index charts/.ci-build/ --merge index.yaml --url ${{ github.server_url }}/${{github.repository}}/releases/download/${{ github.ref_name }}
          cp charts/.ci-build/index.yaml index.yaml
          echo "New index:" && cat index.yaml
          git commit -a -m "bot: update pages index for helm charts"
          git push origin $GH_PAGES_BRANCH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants