Skip to content

Merge pull request #4 from appthrust/feat-helm-charts #4

Merge pull request #4 from appthrust/feat-helm-charts

Merge pull request #4 from appthrust/feat-helm-charts #4

name: Publish Helm Chart
on:
push:
tags:
- 'v*.*.*' # タグ push (例: v1.2.3) でのみ実行
workflow_dispatch: {}
jobs:
release-chart:
name: Package & Publish Helm Chart
runs-on: ubuntu-latest
# Allow pushing to gh-pages
permissions:
contents: write # Required for peaceiris/actions-gh-pages to push
steps:
- name: "Checkout source"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Set up Helm"
uses: azure/setup-helm@v4
with:
version: v3.14.3
# タグ push (refs/tags/vX.Y.Z) 時はバージョン文字列を取り出して環境変数 VERSION に設定
- name: "Extract version from tag"
if: startsWith(github.ref, 'refs/tags/')
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: "Package chart"
run: |
set -e
helm lint charts/plexaubnet
mkdir -p _dist
if [ -n "${VERSION:-}" ]; then
echo "Packaging chart with version $VERSION"
helm package charts/plexaubnet \
--version "$VERSION" \
--app-version "$VERSION" \
--destination _dist
else
echo "Packaging chart with Chart.yaml version (no tag detected)"
helm package charts/plexaubnet --destination _dist
fi
- name: "Prepare repo directory"
run: |
mkdir -p repo
cp _dist/*.tgz repo/
# Merge (or create) index.yaml with existing remote contents
if curl -sfL https://appthrust.github.io/plexaubnet/index.yaml -o repo/index.yaml; then
echo "Merged existing index.yaml"
else
echo "No existing index.yaml found; creating new"
fi
helm repo index repo --url https://appthrust.github.io/plexaubnet --merge repo/index.yaml || \
helm repo index repo --url https://appthrust.github.io/plexaubnet
- name: "Publish to gh-pages (same repo)"
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: repo
keep_files: true
# Disable Jekyll on GitHub Pages so Liquid parsing errors in Markdown do not break the deployment
enable_jekyll: false
user_name: github-actions[bot]
user_email: github-actions[bot]@users.noreply.github.com