diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e20332f..c5d75e7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -53,6 +53,18 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Create helm-index branch if missing + run: | + if ! git rev-parse --verify remotes/origin/helm-index &>/dev/null; then + git switch --orphan helm-index + git config user.name "${{ vars.WORKFLOW_USER_NAME }}" + git config user.email "${{ vars.WORKFLOW_USER_EMAIL }}" + git commit --allow-empty -m "Initial commit" + git push --set-upstream origin helm-index + fi - name: Checkout repository uses: actions/checkout@v3 @@ -76,8 +88,8 @@ jobs: helm repo index --url ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.event.release.tag_name }} --merge ./index/index.yaml . mv index.yaml index cd index - git config user.name github-actions - git config user.email github-actions@github.com + git config user.name "${{ vars.WORKFLOW_USER_NAME }}" + git config user.email "${{ vars.WORKFLOW_USER_EMAIL }}" git add index.yaml git commit -m "Release ${{ github.event.release.tag_name }}" git push