.gitea/workflows/update-images.yaml を更新

This commit is contained in:
2025-12-05 01:48:30 +00:00
parent 725d1c0841
commit 9031d153c1

View File

@@ -140,19 +140,51 @@ jobs:
- name: Update Helm Repository Index - name: Update Helm Repository Index
if: steps.check_update.outputs.update_needed == 'true' if: steps.check_update.outputs.update_needed == 'true'
run: | run: |
set -e
WP_VERSION="${{ steps.wordpress.outputs.wp_version }}" WP_VERSION="${{ steps.wordpress.outputs.wp_version }}"
CHART_NAME=$(grep '^name:' Chart.yaml | awk '{print $2}') CHART_NAME=$(grep '^name:' Chart.yaml | awk '{print $2}')
PACKAGE_FILE="${CHART_NAME}-${WP_VERSION}.tgz" PACKAGE_FILE="${CHART_NAME}-${WP_VERSION}.tgz"
git fetch origin gh-pages || git checkout --orphan gh-pages
git checkout gh-pages || (git checkout --orphan gh-pages && git rm -rf .) echo "Preparing Helm repository update..."
mv "${PACKAGE_FILE}" .
helm repo index . --url https://gitea.example.com/${GITHUB_REPOSITORY}/raw/branch/gh-pages # パッケージファイルを一時ディレクトリに移動
mkdir -p /tmp/helm-repo
cp "${PACKAGE_FILE}" /tmp/helm-repo/
# gh-pagesブランチの処理
if git ls-remote --heads origin gh-pages | grep gh-pages; then
echo "gh-pages branch exists, checking out..."
git fetch origin gh-pages
git checkout gh-pages
else
echo "Creating new gh-pages branch..."
git checkout --orphan gh-pages
git rm -rf . || true
echo "# Helm Repository" > README.md
git add README.md
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
git commit -m "Initialize gh-pages branch"
git push origin gh-pages
fi
# パッケージファイルをコピー
cp /tmp/helm-repo/"${PACKAGE_FILE}" .
# index.yamlを生成/更新
helm repo index . --url "https://gitea.example.com/${GITHUB_REPOSITORY}/raw/branch/gh-pages"
# コミットしてプッシュ
git config user.name "GitHub Actions Bot" git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com" git config user.email "actions@github.com"
git add "${PACKAGE_FILE}" index.yaml git add "${PACKAGE_FILE}" index.yaml
git commit -m "chore: add ${CHART_NAME} v${WP_VERSION}" git commit -m "chore: add ${CHART_NAME} v${WP_VERSION}" || echo "No changes to commit"
git push origin gh-pages git push origin gh-pages
echo "Helm repository updated"
echo "Helm repository updated successfully"
# mainブランチに戻る
git checkout main
- name: Summary - name: Summary
if: steps.check_update.outputs.update_needed == 'true' if: steps.check_update.outputs.update_needed == 'true'