fix: publish Helm chart to Gitea Package Registry instead of gh-pages
All checks were successful
Helm Chart Release / release-chart (push) Successful in 5s
Update Docker Image Tags and Release Helm Chart / update-and-release (push) Successful in 13s

Replace gh-pages branch index approach with direct upload to the
official Gitea Package Registry (same method as helm-release.yaml).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-19 21:13:38 +09:00
parent d2c3b9671f
commit ce6fcab5f3

View File

@@ -5,6 +5,10 @@ on:
- cron: '0 2 * * 1' - cron: '0 2 * * 1'
workflow_dispatch: workflow_dispatch:
env:
REGISTRY_URL: https://git.cafepieters.com
OWNER: helmchart
jobs: jobs:
update-and-release: update-and-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -222,7 +226,9 @@ jobs:
if: steps.check_update.outputs.php_updated == 'true' if: steps.check_update.outputs.php_updated == 'true'
run: | run: |
helm package . helm package .
echo "Helm chart packaged" CHART_FILE=$(ls *.tgz)
echo "CHART_FILE=${CHART_FILE}" >> $GITHUB_ENV
echo "Helm chart packaged: ${CHART_FILE}"
- name: Create Git Tag - name: Create Git Tag
if: steps.check_update.outputs.php_updated == 'true' if: steps.check_update.outputs.php_updated == 'true'
@@ -258,54 +264,18 @@ jobs:
echo "Release created" echo "Release created"
fi fi
- name: Update Helm Repository Index - name: Publish to Gitea Package Registry
if: steps.check_update.outputs.php_updated == 'true' if: steps.check_update.outputs.php_updated == 'true'
run: | run: |
set -e echo "🚀 Publishing ${CHART_FILE} to Gitea Package Registry..."
APP_VERSION="${{ steps.php.outputs.app_version }}"
CHART_NAME=$(grep '^name:' Chart.yaml | awk '{print $2}')
PACKAGE_FILE="${CHART_NAME}-${APP_VERSION}.tgz"
echo "Preparing Helm repository update..." curl --fail-with-body \
-u "${{ secrets.REGISTRY_USER }}:${{ secrets.REGISTRY_TOKEN }}" \
-X POST \
--upload-file "${CHART_FILE}" \
"${REGISTRY_URL}/api/packages/${OWNER}/helm/api/charts"
# パッケージファイルを一時ディレクトリに移動 echo "✅ Chart published successfully!"
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://git.cafepieters.com/${GITHUB_REPOSITORY}/raw/branch/gh-pages"
# コミットしてプッシュ
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
git add "${PACKAGE_FILE}" index.yaml
git commit -m "chore: add ${CHART_NAME} v${APP_VERSION}" || echo "No changes to commit"
git push origin gh-pages
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'