Skip to content

Commit

Permalink
fix(ci): do not sign with no real chart update.
Browse files Browse the repository at this point in the history
Sign Helm chart only if the Helm chart has changed. If the chart version
is already released, skip the signing step and the provenance file
generation.

Signed-off-by: José Guilherme Vanz <[email protected]>
  • Loading branch information
jvanz committed Oct 31, 2024
1 parent 9bc26d2 commit a972bc3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/helm-chart-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ jobs:

- name: Publish and sign kubewarden-crds chart in OCI registry
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -ex
chart_name=kubewarden-crds
Expand All @@ -162,6 +164,15 @@ jobs:
echo "$chart_path does not exist. Assuming no charts update"
exit 0
fi
# check if the chart version is already release. If so, do nothing
chart_version=$(helm show chart $chart_path | yq -r '.version')
if gh release view $chart_name-$chart_version; then
echo "Chart $chart_name-$chart_version already released. Skipping"
exit 0
fi
REGISTRY="ghcr.io/$GITHUB_REPOSITORY_OWNER/charts"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
push_output=$(helm push $chart_path "oci://$REGISTRY" 2>&1)
Expand All @@ -180,6 +191,8 @@ jobs:

- name: Publish and sign kubewarden-controller chart in OCI registry
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -ex
chart_name=kubewarden-controller
Expand All @@ -190,6 +203,14 @@ jobs:
echo "$chart_path does not exist. Assuming no charts update"
exit 0
fi
# check if the chart version is already release. If so, do nothing
chart_version=$(helm show chart $chart_path | yq -r '.version')
if gh release view $chart_name-$chart_version; then
echo "Chart $chart_name-$chart_version already released. Skipping"
exit 0
fi
REGISTRY="ghcr.io/$GITHUB_REPOSITORY_OWNER/charts"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
push_output=$(helm push $chart_path "oci://$REGISTRY" 2>&1)
Expand All @@ -208,6 +229,8 @@ jobs:

- name: Publish and sign kubewarden-defaults chart in OCI registry
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -ex
chart_name=kubewarden-defaults
Expand All @@ -218,6 +241,14 @@ jobs:
echo "$chart_path does not exist. Assuming no charts update"
exit 0
fi
# check if the chart version is already release. If so, do nothing
chart_version=$(helm show chart $chart_path | yq -r '.version')
if gh release view $chart_name-$chart_version; then
echo "Chart $chart_name-$chart_version already released. Skipping"
exit 0
fi
REGISTRY="ghcr.io/$GITHUB_REPOSITORY_OWNER/charts"
echo "REGISTRY=${REGISTRY}" >> "$GITHUB_ENV"
push_output=$(helm push $chart_path "oci://$REGISTRY" 2>&1)
Expand Down

0 comments on commit a972bc3

Please sign in to comment.