diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index fd10008..f2a1786 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -42,7 +42,8 @@ jobs: env: HELM_VERSION: v3.0.2 HELM_TMP_DIR: /tmp/helm-tmp-package - HELM_PUB_DIR: release + HELM_RELEASE_DIR: release + HELM_RELEASE_BRANCH: gh-release steps: - uses: actions/checkout@v2 @@ -67,35 +68,45 @@ jobs: - uses: actions/checkout@v2 with: ref: gh-pages - path: ./release + path: ./gh-pages token: ${{ secrets.GITHUB_TOKEN }} - name: Debug run: | ls -la . - ls -la ${HELM_PUB_DIR} + ls -la ${HELM_RELEASE_BRANCH} + ls -la ${HELM_RELEASE_BRANCH}/${HELM_RELEASE_DIR} ls -la ${HELM_TMP_DIR} - name: Helm Publish run: | + cd ${HELM_RELEASE_BRANCH} + for chart in ${HELM_TMP_DIR}/*; do chart=$(basename $chart) echo $chart - if [ ! -f "${HELM_PUB_DIR}/${chart}" ]; then - mv -vn "${HELM_TMP_DIR}/${chart}" "${HELM_PUB_DIR}/${chart}" + if [ ! -f "${HELM_RELEASE_DIR}/${chart}" ]; then + mv -vn "${HELM_TMP_DIR}/${chart}" "${HELM_RELEASE_DIR}/${chart}" else echo "Chart $chart is already released!" fi - - helm repo index . done + + # Generate new index.yaml + helm repo index ${HELM_RELEASE_DIR} --url ${HELM_RELEASE_DIR} + + # Move generated index.yaml to root dir + mv ${HELM_RELEASE_DIR}/index.yaml . + - name: Git Push run: | - git add -v ${HELM_PUB_DIR} + cd ${HELM_RELEASE_BRANCH} + + git add -v ${HELM_RELEASE_DIR} git status - if ! $(git diff-index --quiet HEAD -- ${HELM_PUB_DIR}/*); then + if ! $(git diff-index --quiet HEAD -- ${HELM_RELEASE_DIR}/*); then git add -v index.yaml git status git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"