Fix release workflows

- Check for dirty repository in release
- Fix helm release workflow name
- Rename dist dir to manifests as dist is used by goreleaser
This commit is contained in:
M Essam Hamed
2025-01-30 00:33:03 +02:00
parent 64091a6439
commit 0219fe8aad
5 changed files with 97 additions and 21 deletions
+5
View File
@@ -39,6 +39,11 @@ jobs:
with:
fetch-depth: 0 # It is required for GoReleaser to work properly
- name: Install modules
run: go mod tidy
- name: check git status
run: git --no-pager diff --exit-code
# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
+45 -15
View File
@@ -1,4 +1,4 @@
name: Release Helm Chart and Carvel package
name: Release Helm Chart
on:
push:
@@ -9,28 +9,58 @@ on:
- main
jobs:
release:
chart-release:
runs-on: ubuntu-latest
env:
CHART_BASE_DIR: helm
GH_PAGES_BRANCH: gh-pages
permissions:
contents: write
pages: write
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
- name: Set ENVs
id: env-setup
run: |
echo "SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Install Helm
uses: azure/setup-helm@v3.4
with:
version: v3.4.2
- name: Package Charts
run: |
# Package charts
mkdir -p charts/.ci-build
echo "Setting chart version to ${{ steps.env-setup.outputs.CHART_VERSION }}"
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.4.1
for DIR in $CHART_BASE_DIR/*; do
# Check if Chart.yaml exists in this directory
if [ -f "${DIR}/Chart.yaml" ]; then
echo "Packaging ${DIR}"
helm dependency update $DIR
helm lint $DIR
helm package $DIR --destination charts/.ci-build
fi
done
git fetch --all
- name: Upload chart artifacts
uses: actions/upload-artifact@v4
with:
charts_dir: helm
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_RELEASE_NAME_TEMPLATE: "helm-v{{ .Version }}"
name: helm-charts-${{ github.ref_name }}
path: charts/.ci-build/*
retention-days: 30
- name: Publish to GH-Pages
id: ghpublish
run: |
git checkout $GH_PAGES_BRANCH --force
helm repo index charts/.ci-build/ --merge index.yaml --url ${{ github.server_url }}/${{github.repository}}/releases/download/${{ github.ref_name }}
cp charts/.ci-build/index.yaml index.yaml
echo "New index:" && cat index.yaml
git add index.yaml charts
git commit -a -m "bot: update pages index for helm charts"
git push origin $GH_PAGES_BRANCH