Repository navigation
Build Helm Charts on Tag #39
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: Build Helm Charts on Tag | |
| # The workflow is triggered when a tag is pushed | |
| on: | |
| push: | |
| tags: | |
| - "chart-*" | |
| workflow_dispatch: | |
| inputs: | |
| chart_tag: | |
| description: "Existing chart tag to release, for example chart-2.0.5" | |
| required: true | |
| type: string | |
| jobs: | |
| release: | |
| permissions: | |
| contents: read | |
| packages: write | |
| runs-on: ubuntu-latest | |
| env: | |
| CHART_REPOSITORY: ${{ github.repository_owner }}/librechat-chart | |
| steps: | |
| - name: Resolve chart tag | |
| id: chart-version | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| INPUT_CHART_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.chart_tag || '' }} | |
| REF_NAME: ${{ github.ref_name }} | |
| run: | | |
| set -euo pipefail | |
| CHART_TAG="$REF_NAME" | |
| if [ "$EVENT_NAME" = "workflow_dispatch" ]; then | |
| CHART_TAG="$INPUT_CHART_TAG" | |
| fi | |
| CHART_VERSION="${CHART_TAG#chart-}" | |
| SEMVER_REGEX='^[0-9]+[.][0-9]+[.][0-9]+(-[0-9A-Za-z.-]+)?([+][0-9A-Za-z.-]+)?$' | |
| if [[ "$CHART_TAG" != chart-* || ! "$CHART_VERSION" =~ $SEMVER_REGEX ]]; then | |
| echo "::error::Chart tags must use the form chart-<semver>, for example chart-2.0.3" | |
| exit 1 | |
| fi | |
| { | |
| printf 'CHART_REF=refs/tags/%s\n' "$CHART_TAG" | |
| printf 'CHART_TAG=%s\n' "$CHART_TAG" | |
| printf 'CHART_VERSION=%s\n' "$CHART_VERSION" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| ref: ${{ steps.chart-version.outputs.CHART_REF }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
| - name: Install Helm | |
| uses: azure/setup-helm@v5 | |
| env: | |
| GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
| - name: Build Subchart Deps | |
| run: | | |
| cd helm/librechat-rag-api | |
| helm dependency build | |
| cd ../librechat | |
| helm dependency build | |
| # Log in to GitHub Container Registry | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Run Helm OCI Charts Releaser | |
| # This is for the librechat chart | |
| - name: Release Helm OCI Charts for librechat | |
| uses: appany/helm-oci-chart-releaser@v0.4.2 | |
| with: | |
| name: librechat | |
| repository: ${{ env.CHART_REPOSITORY }} | |
| tag: ${{ steps.chart-version.outputs.CHART_VERSION }} | |
| path: helm/librechat | |
| registry: ghcr.io | |
| registry_username: ${{ github.actor }} | |
| registry_password: ${{ secrets.GITHUB_TOKEN }} | |
| # this is for the librechat-rag-api chart | |
| - name: Release Helm OCI Charts for librechat-rag-api | |
| uses: appany/helm-oci-chart-releaser@v0.4.2 | |
| with: | |
| name: librechat-rag-api | |
| repository: ${{ env.CHART_REPOSITORY }} | |
| tag: ${{ steps.chart-version.outputs.CHART_VERSION }} | |
| path: helm/librechat-rag-api | |
| registry: ghcr.io | |
| registry_username: ${{ github.actor }} | |
| registry_password: ${{ secrets.GITHUB_TOKEN }} |