Skip to content

Commit

Permalink
chart-releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
andreev-io committed Jan 23, 2025
1 parent 76379d8 commit f53add7
Showing 1 changed file with 27 additions and 50 deletions.
77 changes: 27 additions & 50 deletions .github/workflows/kubenetmon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,56 +214,33 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Helm
uses: azure/setup-helm@v4

- name: Generate Version
id: version
# - name: Install Helm
# uses: azure/setup-helm@v4

# - name: Generate Version
# id: version
# run: |
# # Use short commit SHA as the version
# VERSION="0.1.0-$(git rev-parse --short HEAD)"
# echo "VERSION=$VERSION" >> $GITHUB_ENV

# - name: Update chart version
# run: |
# for chart in deploy/helm/kubenetmon-agent deploy/helm/kubenetmon-server; do
# sed -i "s/^version:.*/version: $VERSION/" $chart/Chart.yaml
# sed -i "s/^appVersion:.*/appVersion: $VERSION/" $chart/Chart.yaml
# done

- name: Configure Git
run: |
# Use short commit SHA as the version
VERSION="0.1.0-$(git rev-parse --short HEAD)"
echo "VERSION=$VERSION" >> $GITHUB_ENV
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Update chart version
run: |
for chart in deploy/helm/kubenetmon-agent deploy/helm/kubenetmon-server; do
sed -i "s/^version:.*/version: $VERSION/" $chart/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: $VERSION/" $chart/Chart.yaml
done
- name: Package Helm charts
run: |
mkdir -p .cr-release-packages
for chart in deploy/helm/kubenetmon-agent deploy/helm/kubenetmon-server; do
helm package $chart --destination .cr-release-packages
done
- name: Upload Helm charts to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: .cr-release-packages/*
tag_name: latest
generate_release_notes: true

- name: Install Skopeo
run: |
sudo apt-get update
sudo apt-get install -y skopeo
- name: Push charts to GHCR
run: |
for chart in .cr-release-packages/*.tgz; do
CHART_NAME=$(helm show chart $chart | grep '^name:' | awk '{print $2}')
CHART_VERSION=$(helm show chart $chart | grep '^version:' | awk '{print $2}')
helm push $chart oci://ghcr.io/clickhouse/kubenetmon/charts
skopeo copy \
oci://ghcr.io/clickhouse/kubenetmon/charts/$CHART_NAME:$CHART_VERSION \
oci://ghcr.io/clickhouse/kubenetmon/charts/$CHART_NAME:latest
done
charts_dir: deploy/helm
mark_as_latest: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_GENERATE_RELEASE_NOTES: true

0 comments on commit f53add7

Please sign in to comment.