96 lines
2.9 KiB
YAML
96 lines
2.9 KiB
YAML
name: Release Helm Chart
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write
|
|
packages: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
submodules: true
|
|
|
|
- name: Set up Helm
|
|
uses: azure/setup-helm@v4
|
|
with:
|
|
version: v3.14.0
|
|
|
|
- name: Bump chart version
|
|
id: bump
|
|
run: |
|
|
# Read current version
|
|
CURRENT_VERSION=$(grep '^version:' Chart.yaml | awk '{print $2}')
|
|
echo "Current version: $CURRENT_VERSION"
|
|
|
|
# Parse version components
|
|
MAJOR=$(echo $CURRENT_VERSION | cut -d. -f1)
|
|
MINOR=$(echo $CURRENT_VERSION | cut -d. -f2)
|
|
PATCH=$(echo $CURRENT_VERSION | cut -d. -f3)
|
|
|
|
# Increment minor, reset patch
|
|
NEW_MINOR=$((MINOR + 1))
|
|
NEW_VERSION="${MAJOR}.${NEW_MINOR}.0"
|
|
echo "New version: $NEW_VERSION"
|
|
|
|
# Update Chart.yaml
|
|
sed -i "s/^version: .*/version: $NEW_VERSION/" Chart.yaml
|
|
sed -i "s/^appVersion: .*/appVersion: \"$NEW_VERSION\"/" Chart.yaml
|
|
|
|
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Commit version bump
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add Chart.yaml
|
|
git commit -m "chore: bump chart version to ${{ steps.bump.outputs.version }} [skip ci]"
|
|
git push
|
|
|
|
- name: Login to GHCR
|
|
run: |
|
|
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
|
|
- name: Update dependencies
|
|
run: helm dependency update
|
|
|
|
- name: Package chart
|
|
run: helm package .
|
|
|
|
- name: Push to GHCR
|
|
run: |
|
|
helm push dot-ai-stack-*.tgz oci://ghcr.io/vfarcic/dot-ai-stack/charts
|
|
|
|
- name: Check if docs changed
|
|
id: docs-check
|
|
run: |
|
|
if git rev-parse HEAD~2 >/dev/null 2>&1; then
|
|
# Check the commit before the version bump (HEAD~1) against HEAD~2
|
|
DOCS_CHANGED=$(git diff --name-only HEAD~2 HEAD~1 -- README.md docs/ | wc -l)
|
|
else
|
|
DOCS_CHANGED=1 # First commit or second commit, trigger rebuild
|
|
fi
|
|
if [ "$DOCS_CHANGED" -gt 0 ]; then
|
|
echo "docs-changed=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "docs-changed=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Trigger Website Rebuild
|
|
if: steps.docs-check.outputs.docs-changed == 'true'
|
|
uses: peter-evans/repository-dispatch@v3
|
|
with:
|
|
token: ${{ secrets.WEBSITE_DISPATCH_TOKEN }}
|
|
repository: vfarcic/dot-ai-website
|
|
event-type: upstream-release
|
|
client-payload: '{"source": "dot-ai-stack"}'
|