Skip to content

Commit c1d2cc7

Browse files
authored
Fix Release Charts github action (#1675)
* Fix Release Charts github action * use yq instead of grep
1 parent 73b5228 commit c1d2cc7

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

.github/workflows/release.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
push:
66
branches:
77
- main
8-
# Release only if the 'version' field in Chart.yaml was updated
9-
paths:
10-
- helm-charts/**/Chart.yaml
118

129
jobs:
1310
maybe_update:
@@ -18,37 +15,37 @@ jobs:
1815
with:
1916
fetch-depth: 0
2017

21-
- name: Validate Chart.yaml Update
18+
- name: Check if the release is needed
2219
id: check_update_chart
2320
run: |
24-
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)
25-
CURRENT_VERSION=$(cat helm-charts/splunk-otel-collector/Chart.yaml | grep -E "^version:" | cut -d " " -f 2)
21+
LATEST_VERSION=$(curl -s https://signalfx.github.io/splunk-otel-collector-chart/index.yaml | yq e '.entries["splunk-otel-collector"][0].version')
22+
CURRENT_VERSION=$(yq e '.version' helm-charts/splunk-otel-collector/Chart.yaml)
2623
if [ "$LATEST_VERSION" != "$CURRENT_VERSION" ]; then
2724
echo "New release needed, creating..."
28-
echo "VALID_UPDATE=1" >> $GITHUB_OUTPUT
25+
echo "NEED_RELEASE=1" >> $GITHUB_OUTPUT
2926
else
3027
echo "No new release needed"
31-
echo "VALID_UPDATE=0" >> $GITHUB_OUTPUT
28+
echo "NEED_RELEASE=0" >> $GITHUB_OUTPUT
3229
fi
3330
exit 0
3431
3532
- name: Configure Git
3633
run: git config user.name "$GITHUB_ACTOR" && git config user.email "[email protected]"
37-
if: ${{ steps.check_update_chart.outputs.VALID_UPDATE == 1 }}
34+
if: ${{ steps.check_update_chart.outputs.NEED_RELEASE == 1 }}
3835

3936
- name: Install Helm
4037
uses: azure/setup-helm@v4
4138
with:
4239
version: v3.11.3
43-
if: ${{ steps.check_update_chart.outputs.VALID_UPDATE == 1 }}
40+
if: ${{ steps.check_update_chart.outputs.NEED_RELEASE == 1 }}
4441

4542
- name: Set up chart dependencies
4643
run: make render
47-
if: ${{ steps.check_update_chart.outputs.VALID_UPDATE == 1 }}
44+
if: ${{ steps.check_update_chart.outputs.NEED_RELEASE == 1 }}
4845

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

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

0 commit comments

Comments
 (0)