Skip to content

Commit

Permalink
Fix Release Charts github action
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax committed Feb 21, 2025
1 parent 73b5228 commit cf5f5f4
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: Release Charts

on:
workflow_dispatch:
push:
branches:
- main
# Release only if the 'version' field in Chart.yaml was updated
paths:
- helm-charts/**/Chart.yaml

jobs:
maybe_update:
Expand All @@ -18,37 +14,37 @@ jobs:
with:
fetch-depth: 0

- name: Validate Chart.yaml Update
- name: Check if the release is needed
id: check_update_chart
run: |
LATEST_VERSION=$(curl -s https://api.github.com/repos/signalfx/splunk-otel-collector-chart/releases/latest | grep tag_name | cut -d - -f 4 | cut -d \" -f 1)
CURRENT_VERSION=$(cat helm-charts/splunk-otel-collector/Chart.yaml | grep -E "^version:" | cut -d " " -f 2)
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then
echo "New release needed, creating..."
echo "VALID_UPDATE=1" >> $GITHUB_OUTPUT
echo "NEED_RELEASE=1" >> $GITHUB_OUTPUT
else
echo "No new release needed"
echo "VALID_UPDATE=0" >> $GITHUB_OUTPUT
echo "NEED_RELEASE=0" >> $GITHUB_OUTPUT
fi
exit 0
- name: Configure Git
run: git config user.name "$GITHUB_ACTOR" && git config user.email "[email protected]"
if: ${{ steps.check_update_chart.outputs.VALID_UPDATE == 1 }}
if: ${{ steps.check_update_chart.outputs.NEED_RELEASE == 1 }}

- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.11.3
if: ${{ steps.check_update_chart.outputs.VALID_UPDATE == 1 }}
if: ${{ steps.check_update_chart.outputs.NEED_RELEASE == 1 }}

- name: Set up chart dependencies
run: make render
if: ${{ steps.check_update_chart.outputs.VALID_UPDATE == 1 }}
if: ${{ steps.check_update_chart.outputs.NEED_RELEASE == 1 }}

- name: Generate Release Notes
run: make chlog-release-notes OUTPUT=file
if: ${{ steps.check_update_chart.outputs.VALID_UPDATE == 1 }}
if: ${{ steps.check_update_chart.outputs.NEED_RELEASE == 1 }}

- name: Run chart-releaser
uses: helm/[email protected]
Expand All @@ -57,4 +53,4 @@ jobs:
config: .github/workflows/configs/cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: ${{ steps.check_update_chart.outputs.VALID_UPDATE == 1 }}
if: ${{ steps.check_update_chart.outputs.NEED_RELEASE == 1 }}

0 comments on commit cf5f5f4

Please sign in to comment.