chart-releaser-action
chart-releaser-action copied to clipboard
GitHub Actions Failure: Helm Chart Release Process Encounters Non-Fast-Forward Push Error and cr upload Exit Status 1
Hello, I have encountered an error in GitHub actions, and I am currently finding it quite challenging to resolve. I would greatly appreciate your guidance on how to proceed. Thank you for your assistance.
- https://github.com/OpenIMSDK/helm-charts
Error:
Pushing to branch "gh-pages"
To https://github.com/openimsdk/helm-charts
! [rejected] HEAD -> gh-pages (non-fast-forward)
error: failed to push some refs to 'https://github.com/openimsdk/helm-charts'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you want to integrate the remote changes, use 'git pull'
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Error: exit status 1
Usage:
cr upload [flags]
Flags:
-c, --commit string Target commit for release
--generate-release-notes Whether to automatically generate the name and body for this release. See https://docs.github.com/en/rest/releases/releases
-b, --git-base-url string GitHub Base URL (only needed for private GitHub) (default "https://api.github.com/")
-r, --git-repo string GitHub repository
-u, --git-upload-url string GitHub Upload URL (only needed for private GitHub) (default "https://uploads.github.com/")
-h, --help help for upload
--make-release-latest Mark the created GitHub release as 'latest' (default true)
-o, --owner string GitHub username or organization
-p, --package-path string Path to directory with chart packages (default ".cr-release-packages")
--packages-with-index Host the package files in the GitHub Pages branch
--pages-branch string The GitHub pages branch (default "gh-pages")
--pr Create a pull request for the chart package against the GitHub Pages branch (must not be set if --push is set)
--push Push the chart package to the GitHub Pages branch (must not be set if --pr is set)
--release-name-template string Go template for computing release names, using chart metadata (default "{{ .Name }}-{{ .Version }}")
--release-notes-file string Markdown file with chart release notes. If it is set to empty string, or the file is not found, the chart description will be used instead. The file is read from the chart package
--remote string The Git remote used when creating a local worktree for the GitHub Pages branch (default "origin")
--skip-existing Skip upload if release exists
-t, --token string GitHub Auth Token
Global Flags:
--config string Config file (default is $HOME/.cr.yaml)
My actions file:
## Reference: https://github.com/helm/chart-releaser-action
name: Chart Publish
on:
push:
branches:
- main
# paths:
# - "charts/**"
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)
packages: write # needed for ghcr access
id-token: write # needed for keyless signing
jobs:
publish:
permissions:
contents: write # for helm/chart-releaser-action to push chart release and create a release
packages: write # to push OCI chart package to GitHub Registry
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.10.1 # Also update in lint-and-test.yaml
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Fetch history
run: git checkout origin/gh-pages index.yaml
- name: Run chart-releaser
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
with:
charts_dir: charts
config: "./.github/configs/cr.yaml"
packages_with_index: true
env:
CR_TOKEN: "${{ secrets.BOT_GITHUB_TOKEN }}"
CR_GENERATE_RELEASE_NOTES: true
- name: Login to GHCR
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push chart to GHCR
run: |
shopt -s nullglob
for pkg in .cr-release-packages/*.tgz; do
if [ -z "${pkg:-}" ]; then
break
fi
helm push "${pkg}" oci://ghcr.io/${{ github.repository }}
done
env:
HELM_EXPERIMENTAL_OCI: 1