Skip to content

Commit 6b963cb

Browse files
committed
Chore: modify the GitHub Action to sync app version changes and update the chart version if there are any configuration changes
1 parent 0d92b6a commit 6b963cb

File tree

2 files changed

+3
-24
lines changed

2 files changed

+3
-24
lines changed

.github/workflows/manual-chart-release.yaml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,20 @@ jobs:
5959
run: |
6060
CHART_VERSION="${{ github.event.inputs.chart_version }}"
6161
CHART_NAME="${{ github.event.inputs.chart_name }}"
62-
6362
# Validate chart version format
6463
if [[ ! "$CHART_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
6564
echo "Invalid chart version format. Use semantic versioning (e.g., 0.2.0)"
6665
exit 1
6766
fi
68-
6967
# Check if chart exists
7068
if [ ! -f "charts/$CHART_NAME/Chart.yaml" ]; then
7169
echo "Chart not found: charts/$CHART_NAME/Chart.yaml"
7270
exit 1
7371
fi
74-
7572
# Get current version and compare
7673
CURRENT_VERSION=$(yq eval '.version' "charts/$CHART_NAME/Chart.yaml")
7774
echo "Current chart version: $CURRENT_VERSION"
7875
echo "New chart version: $CHART_VERSION"
79-
8076
if [ "$CURRENT_VERSION" = "$CHART_VERSION" ]; then
8177
echo "Warning: New version is the same as current version"
8278
echo "This will still proceed but may not create a new release"
@@ -87,20 +83,15 @@ jobs:
8783
CHART_NAME="${{ github.event.inputs.chart_name }}"
8884
CHART_VERSION="${{ github.event.inputs.chart_version }}"
8985
APP_VERSION="${{ github.event.inputs.app_version }}"
90-
9186
CHART_FILE="charts/$CHART_NAME/Chart.yaml"
92-
9387
# Backup original
9488
cp "$CHART_FILE" "$CHART_FILE.backup"
95-
9689
# Update both chart version and appVersion
9790
yq eval '.version = "'$CHART_VERSION'"' -i "$CHART_FILE"
9891
yq eval '.appVersion = "'$APP_VERSION'"' -i "$CHART_FILE"
99-
10092
echo "Updated $CHART_FILE:"
10193
echo " Chart version: $CHART_VERSION"
10294
echo " App version: $APP_VERSION"
103-
10495
# Show the changes
10596
echo "Changes made:"
10697
diff "$CHART_FILE.backup" "$CHART_FILE" || true
@@ -113,11 +104,9 @@ jobs:
113104
- name: Validate Chart
114105
run: |
115106
CHART_NAME="${{ github.event.inputs.chart_name }}"
116-
117-
# Install Helm is now handled by the previous step
107+
# Install Helm is now handled by the previous step
118108
echo "Testing template generation..."
119109
helm template test-release charts/$CHART_NAME > /dev/null
120-
121110
echo "Chart validation passed!"
122111
123112
- name: Commit Changes
@@ -127,15 +116,12 @@ jobs:
127116
APP_VERSION="${{ github.event.inputs.app_version }}"
128117
RELEASE_TYPE="${{ github.event.inputs.release_type }}"
129118
RELEASE_NOTES="${{ github.event.inputs.release_notes }}"
130-
131119
git add charts/$CHART_NAME/Chart.yaml
132-
133120
if git diff --staged --quiet; then
134121
echo "No changes to commit"
135122
echo "skip_release=true" >> $GITHUB_ENV
136123
exit 0
137124
fi
138-
139125
git commit -m "Release $CHART_NAME chart v$CHART_VERSION"
140126
141127
- name: Push Changes
@@ -154,7 +140,6 @@ jobs:
154140
run: |
155141
CHART_VERSION="${{ github.event.inputs.chart_version }}"
156142
RELEASE_TYPE="${{ github.event.inputs.release_type }}"
157-
158143
echo "Chart Release Completed Successfully!"
159144
echo ""
160145
echo "Chart: ${{ github.event.inputs.chart_name }}"

.github/workflows/update-app-version.yaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,9 @@ jobs:
3131
3232
- name: Install yq
3333
run: |
34-
YQ_VERSION="v4.43.1"
35-
YQ_BINARY="yq_linux_amd64"
36-
YQ_URL="https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}"
37-
YQ_SHA_URL="https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}.sha256"
38-
wget -qO "${YQ_BINARY}" "${YQ_URL}"
39-
wget -qO "${YQ_BINARY}.sha256" "${YQ_SHA_URL}"
40-
sha256sum --check --status "${YQ_BINARY}.sha256"
41-
sudo mv "${YQ_BINARY}" /usr/local/bin/yq
34+
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
4235
sudo chmod +x /usr/local/bin/yq
36+
yq --version
4337
4438
- name: Update App Version Only
4539
run: |

0 commit comments

Comments
 (0)