Skip to content

PLTF-4: Automate LiteLLM setup (#253) #151

PLTF-4: Automate LiteLLM setup (#253)

PLTF-4: Automate LiteLLM setup (#253) #151

name: Publish Helm Charts
on:
# Run on all pushes to main
push:
branches:
- main
paths:
- 'charts/**'
# Manual trigger
workflow_dispatch:
jobs:
validate-chart-versions:
uses: ./.github/workflows/validate-chart-versions.yml
with:
base_ref: HEAD~1
enforce_version_bump: true
test-charts:
runs-on: ubuntu-latest
needs: [validate-chart-versions]
strategy:
matrix:
chart:
- name: runtime-api
path: charts/runtime-api
- name: image-loader
path: charts/image-loader
- name: openhands
path: charts/openhands
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: 'latest'
- name: Test ${{ matrix.chart.name }} chart with default values
run: |
echo "Testing ${{ matrix.chart.name }} chart with default values"
echo "Updating dependencies for ${{ matrix.chart.name }}"
helm dependency update ${{ matrix.chart.path }}
echo "Running helm lint for ${{ matrix.chart.name }}"
helm lint ${{ matrix.chart.path }}
if [ $? -ne 0 ]; then
echo "Helm lint test failed for ${{ matrix.chart.name }}"
exit 1
fi
echo "Helm lint test passed for ${{ matrix.chart.name }}"
echo "Running helm template for ${{ matrix.chart.name }}"
helm template ${{ matrix.chart.path }} --debug
if [ $? -ne 0 ]; then
echo "Helm template test failed for ${{ matrix.chart.name }}"
exit 1
fi
echo "Helm template test passed for ${{ matrix.chart.name }}"
publish-charts:
runs-on: ubuntu-latest
needs: test-charts
permissions:
contents: read
packages: write
strategy:
matrix:
chart:
- name: runtime-api
path: charts/runtime-api
- name: image-loader
path: charts/image-loader
- name: openhands
path: charts/openhands
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: 'latest'
- name: Extract chart version and prepare repository
id: chart_info
run: |
VERSION=$(grep '^version:' ${{ matrix.chart.path }}/Chart.yaml | awk '{print $2}')
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Using chart version: ${VERSION}"
# Convert repository owner to lowercase for GHCR
REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
echo "REPO_OWNER=${REPO_OWNER}" >> $GITHUB_OUTPUT
echo "Using repository owner: ${REPO_OWNER}"
- name: Publish ${{ matrix.chart.name }} chart to GHCR
uses: appany/helm-oci-chart-releaser@v0.4.2
with:
name: ${{ matrix.chart.name }}
repository: helm-charts
path: ${{ matrix.chart.path }}
registry: ghcr.io/${{ steps.chart_info.outputs.REPO_OWNER }}
registry_username: ${{ github.actor }}
registry_password: ${{ secrets.GITHUB_TOKEN }}
update_dependencies: 'true'
tag: ${{ steps.chart_info.outputs.VERSION }}