diff --git a/.github/workflows/helmcharts.yml b/.github/workflows/helmcharts.yml index 2b9f7f45de..b76f088776 100644 --- a/.github/workflows/helmcharts.yml +++ b/.github/workflows/helmcharts.yml @@ -37,8 +37,15 @@ jobs: - name: Get Chart Version id: chart-version + env: + REF_NAME: ${{ github.ref_name }} run: | - CHART_VERSION=$(echo "${{ github.ref_name }}" | cut -d'-' -f2) + CHART_VERSION="${REF_NAME#chart-}" + SEMVER_REGEX='^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$' + if [[ ! "$CHART_VERSION" =~ $SEMVER_REGEX ]]; then + echo "Invalid chart version: $CHART_VERSION" >&2 + exit 1 + fi echo "CHART_VERSION=${CHART_VERSION}" >> "$GITHUB_OUTPUT" # Log in to GitHub Container Registry @@ -72,4 +79,4 @@ jobs: path: helm/librechat-rag-api registry: ghcr.io registry_username: ${{ github.actor }} - registry_password: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + registry_password: ${{ secrets.GITHUB_TOKEN }}