fix: Update both version and appVersion in Chart.yaml during WordPress updates
All checks were successful
Helm Chart Release / release-chart (push) Successful in 12s
Update Docker Images and Helm Chart / update (push) Successful in 16s

When WordPress version changes, both Chart.yaml fields should be updated to match:
- version: WordPress version (e.g., 6.9.4)
- appVersion: WordPress version (e.g., 6.9.4)

Previously only 'version' was updated while 'appVersion' remained stale.

Changes:
- Extract current appVersion before update
- Update appVersion with sed command (in addition to version)
- Log both version and appVersion changes

This ensures Chart.yaml always reflects the actual WordPress version deployed.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 08:18:06 +09:00
parent 512c80ab53
commit 20081bdda9

View File

@@ -227,14 +227,19 @@ jobs:
# WordPressバージョン更新時は新しいWPバージョンをそのまま使用サフィックスは付けない # WordPressバージョン更新時は新しいWPバージョンをそのまま使用サフィックスは付けない
if [ -f Chart.yaml ]; then if [ -f Chart.yaml ]; then
CURRENT_CHART_VERSION=$(grep '^version:' Chart.yaml | awk '{print $2}') CURRENT_CHART_VERSION=$(grep '^version:' Chart.yaml | awk '{print $2}')
# values.yamlの新しいWordPressバージョンを取得appVersionではなくimageタグから CURRENT_APP_VERSION=$(grep '^appVersion:' Chart.yaml | awk '{print $2}' | tr -d '"')
# values.yamlの新しいWordPressバージョンを取得imageタグから
NEW_WP_VERSION=$(grep -A 3 'wordpress:' values.yaml | grep 'tag:' | awk -F'"' '{print $2}' | cut -d'-' -f1) NEW_WP_VERSION=$(grep -A 3 'wordpress:' values.yaml | grep 'tag:' | awk -F'"' '{print $2}' | cut -d'-' -f1)
# Chart.yamlはWordPressバージョンに合わせて更新サフィックスなし # Chart.yamlはWordPressバージョンに合わせて更新version と appVersion を同じにする
NEW_CHART_VERSION="$NEW_WP_VERSION" NEW_CHART_VERSION="$NEW_WP_VERSION"
sed -i "s/^version: .*/version: $NEW_CHART_VERSION/" Chart.yaml sed -i "s/^version: .*/version: $NEW_CHART_VERSION/" Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"$NEW_WP_VERSION\"/" Chart.yaml
echo "Chart version updated: $CURRENT_CHART_VERSION -> $NEW_CHART_VERSION" echo "Chart version updated: $CURRENT_CHART_VERSION -> $NEW_CHART_VERSION"
echo "Chart appVersion updated: $CURRENT_APP_VERSION -> $NEW_WP_VERSION"
echo "new_chart_version=$NEW_CHART_VERSION" >> $GITHUB_OUTPUT echo "new_chart_version=$NEW_CHART_VERSION" >> $GITHUB_OUTPUT
else else
echo "Chart.yaml not found, skipping version increment" echo "Chart.yaml not found, skipping version increment"