open-webui-dev-image-published #93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Dev Open WebUI Helm Chart | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| source_sha: | |
| description: "Open WebUI commit SHA that produced the dev image" | |
| required: false | |
| repository_dispatch: | |
| types: | |
| - open-webui-dev-image-published | |
| concurrency: | |
| group: helm-dev-release | |
| cancel-in-progress: false | |
| jobs: | |
| release-dev-chart: | |
| permissions: | |
| contents: write | |
| packages: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v4 | |
| - name: Prepare dev chart | |
| id: chart | |
| run: | | |
| set -euo pipefail | |
| chart_path="charts/open-webui" | |
| current_version="$(awk '/^version:/ { print $2; exit }' "${chart_path}/Chart.yaml")" | |
| IFS='.' read -r major minor patch_extra <<< "${current_version}" | |
| patch="${patch_extra%%[-+]*}" | |
| dev_version="${major}.${minor}.$((patch + 1))-dev.${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}" | |
| mkdir -p .cr-dev-charts | |
| cp -R "${chart_path}" .cr-dev-charts/open-webui | |
| perl -0pi -e "s/^version: .*/version: ${dev_version}/m; s/^appVersion: .*/appVersion: dev/m" \ | |
| .cr-dev-charts/open-webui/Chart.yaml | |
| echo "version=${dev_version}" >> "${GITHUB_OUTPUT}" | |
| - name: Add Dependency Repos | |
| run: | | |
| helm repo add ollama https://otwld.github.io/ollama-helm/ | |
| helm repo add open-webui https://helm.openwebui.com/ | |
| helm repo add tika https://apache.jfrog.io/artifactory/tika/ | |
| helm repo add bitnami https://charts.bitnami.com/bitnami | |
| - name: Build dependencies | |
| run: helm dependency build .cr-dev-charts/open-webui | |
| - name: Validate chart | |
| run: | | |
| helm lint .cr-dev-charts/open-webui | |
| helm template open-webui .cr-dev-charts/open-webui \ | |
| --namespace test-namespace \ | |
| --set ollama.enabled=false \ | |
| --set ollama.service.port=11434 \ | |
| --set pipelines.enabled=false \ | |
| --set tika.enabled=false \ | |
| --set redis-cluster.enabled=false \ | |
| --set postgresql.enabled=false \ | |
| | grep -q "image: ghcr.io/open-webui/open-webui:dev" | |
| - name: Package dev chart | |
| run: | | |
| mkdir -p .cr-release-packages | |
| helm package .cr-dev-charts/open-webui --destination .cr-release-packages | |
| - name: Publish dev chart release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| version="${{ steps.chart.outputs.version }}" | |
| package=".cr-release-packages/open-webui-${version}.tgz" | |
| tag="open-webui-${version}" | |
| if gh release view "${tag}" >/dev/null 2>&1; then | |
| echo "Release ${tag} already exists" | |
| else | |
| gh release create "${tag}" "${package}" \ | |
| --title "${tag}" \ | |
| --notes "Dev Open WebUI Helm chart for ghcr.io/open-webui/open-webui:dev." \ | |
| --prerelease | |
| fi | |
| - name: Checkout Helm index | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: gh-pages | |
| path: .cr-index | |
| - name: Update Helm index | |
| run: | | |
| set -euo pipefail | |
| version="${{ steps.chart.outputs.version }}" | |
| package="open-webui-${version}.tgz" | |
| cp ".cr-release-packages/${package}" .cr-index/ | |
| cd .cr-index | |
| helm repo index . --merge index.yaml | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| git add index.yaml "${package}" | |
| if git diff --cached --quiet; then | |
| echo "Helm index already contains ${package}" | |
| exit 0 | |
| fi | |
| git commit -m "chore(dev): release open-webui ${{ steps.chart.outputs.version }}" | |
| git push | |
| - name: Login to GitHub Container Registry | |
| run: | | |
| echo "${GHCR_REGISTRY_PASSWORD}" | helm registry login ghcr.io --username ${{ github.actor }} --password-stdin | |
| env: | |
| GHCR_REGISTRY_PASSWORD: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Push chart to ghcr.io | |
| run: | | |
| shopt -s nullglob | |
| packages=(.cr-release-packages/*) | |
| if [ "${#packages[@]}" -eq 0 ]; then | |
| echo "No charts to release" | |
| exit 0 | |
| fi | |
| for pkg in "${packages[@]}"; do | |
| helm push "${pkg}" oci://ghcr.io/${{ github.repository }} | |
| done |