-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Release Charts github action (#1675)
* Fix Release Charts github action * use yq instead of grep
- Loading branch information
Showing
1 changed file
with
10 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,6 @@ on: | |
push: | ||
branches: | ||
- main | ||
# Release only if the 'version' field in Chart.yaml was updated | ||
paths: | ||
- helm-charts/**/Chart.yaml | ||
|
||
jobs: | ||
maybe_update: | ||
|
@@ -18,37 +15,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) | ||
LATEST_VERSION=$(curl -s https://signalfx.github.io/splunk-otel-collector-chart/index.yaml | yq e '.entries["splunk-otel-collector"][0].version') | ||
CURRENT_VERSION=$(yq e '.version' helm-charts/splunk-otel-collector/Chart.yaml) | ||
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] | ||
|
@@ -57,4 +54,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 }} |