stefanprodan / helm-gh-pages

A GitHub Action for publishing Helm charts to Github Pages
Apache License 2.0
105 stars 47 forks source link

Root directory chart #37

Open tylerauerbeck opened 1 year ago

tylerauerbeck commented 1 year ago

Does this action support packaging charts that are at the root of the directory? I'm currently seeing Error: need at least one argument, the path to the chart whenever I set charts_dir: .

tylerauerbeck commented 1 year ago

I have a feeling the answer is currently probably a no because of the locate function only looking at type -d

locate() {
    for dir in $(find "${CHARTS_DIR}" -type d -mindepth 1 -maxdepth 1); do
      if [[ -f "${dir}/Chart.yaml" ]]; then
        CHARTS+=("${dir}")
        echo "Found chart directory ${dir}"
      else
        echo "Ignoring non-chart directory ${dir}"
      fi
    done
}

I went ahead and switched locate to do something like:

locate() {
  if [[ "${CHARTS_DIR}" == "." ]]; then
    echo "Chart directory set to repository root. Treating everything as part of the chart."
    CHARTS+=(".")
  else
    for dir in $(find "${CHARTS_DIR}" -type d -mindepth 1 -maxdepth 1); do
      if [[ -f "${dir}/Chart.yaml" ]]; then
        CHARTS+=("${dir}")
        echo "Found chart directory ${dir}"
      else
        echo "Ignoring non-chart directory ${dir}"
      fi
    done
  fi
}

And this now works as expected. Let me know if that is something that you would like to support and I can PR this in.

In the interim, if folks are looking for that functionality, you can go ahead and use tylerauerbeck/helm-gh-pages@main in your workflows.

t3mi commented 1 year ago

FYI specifying charts_dir: ../ could be used as a workaround.