Skip to content

Merge Upstream (#102) #3

Merge Upstream (#102)

Merge Upstream (#102) #3

name: Publish Helm Chart
on:
push:
branches:
- main
paths:
- "charts/**"
- ".github/workflows/push-helm-chart.yml"
release:
types: [published]
workflow_dispatch:
jobs:
publish-helm-chart:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: "latest"
- name: Set up OCI Helper
run: |
echo "Installing Helm plugins..."
helm plugin install https://github.com/chartmuseum/helm-push || true
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Chart Version
if: github.event_name == 'release'
run: |
# When triggered by a release, use the release tag as the chart version
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
echo "Updating Helm chart version to $VERSION"
sed -i "s/^version:.*/version: $VERSION/" charts/mcp-trino/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"$VERSION\"/" charts/mcp-trino/Chart.yaml
- name: Package Helm Chart
run: |
mkdir -p .cr-release-packages
helm package charts/mcp-trino --destination .cr-release-packages
- name: Set lowercase repo name
run: echo "REPO_LOWER=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Push Helm Chart to GHCR
run: |
PACKAGE_NAME=$(ls .cr-release-packages/mcp-trino-*.tgz)
PACKAGE_VERSION=$(basename $PACKAGE_NAME | sed 's/mcp-trino-\(.*\)\.tgz/\1/')
echo "Publishing Helm chart $PACKAGE_NAME (version $PACKAGE_VERSION) to GHCR..."
# Push using Helm OCI
echo "Pushing to OCI registry..."
helm push $PACKAGE_NAME oci://ghcr.io/${{ env.REPO_LOWER }}/charts
echo "Helm chart published to ghcr.io/${{ env.REPO_LOWER }}/charts/mcp-trino:$PACKAGE_VERSION"