Merge pull request #11 from Semih702/chore/helm-regression-ci #9
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 | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths-ignore: | |
| - "**/*.md" | |
| - "docs/**" | |
| - ".github/**" | |
| # push: | |
| # tags: ["v*"] | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| CHART_DIR: charts/llm-gateway | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set tags | |
| run: | | |
| echo "SHA_TAG=sha-${GITHUB_SHA::7}" >> $GITHUB_ENV | |
| echo "DEV_VER=0.1.0-dev-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV | |
| echo "OWNER_LC=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
| - name: Detect changes | |
| uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: | | |
| proxy: | |
| - "proxy/**" | |
| collector: | |
| - "collector/**" | |
| chart: | |
| - "charts/**" | |
| - "deploy/**" | |
| - "values*.yaml" | |
| - "values-*.yaml" | |
| - name: Print change detection | |
| run: | | |
| echo "proxy changed? ${{ steps.changes.outputs.proxy }}" | |
| echo "collector changed? ${{ steps.changes.outputs.collector }}" | |
| echo "chart changed? ${{ steps.changes.outputs.chart }}" | |
| - name: Skip publish if nothing relevant changed | |
| if: steps.changes.outputs.proxy != 'true' && steps.changes.outputs.collector != 'true' && steps.changes.outputs.chart != 'true' | |
| run: | | |
| echo "No proxy/collector/chart changes. Skipping publish." | |
| exit 0 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # ---- Build & push images ---- | |
| - name: Build & push llm-proxy | |
| if: steps.changes.outputs.proxy == 'true' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./proxy | |
| file: ./proxy/Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ env.OWNER_LC }}/llm-proxy:${{ env.SHA_TAG }} | |
| ${{ env.REGISTRY }}/${{ env.OWNER_LC }}/llm-proxy:edge | |
| - name: Build & push llm-collector | |
| if: steps.changes.outputs.collector == 'true' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./collector | |
| file: ./collector/Dockerfile | |
| push: true | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ env.OWNER_LC }}/llm-collector:${{ env.SHA_TAG }} | |
| ${{ env.REGISTRY }}/${{ env.OWNER_LC }}/llm-collector:edge | |
| # ---- Package & push Helm chart to OCI ---- | |
| - name: Setup Helm | |
| if: steps.changes.outputs.chart == 'true' | |
| uses: azure/setup-helm@v4 | |
| - name: Bump Chart.yaml version/appVersion (main snapshots) | |
| if: steps.changes.outputs.chart == 'true' | |
| run: | | |
| python - << 'PY' | |
| import yaml | |
| from pathlib import Path | |
| chart = Path("${{ env.CHART_DIR }}") / "Chart.yaml" | |
| data = yaml.safe_load(chart.read_text()) | |
| data["version"] = "${{ env.DEV_VER }}" | |
| data["appVersion"] = "${{ env.SHA_TAG }}" | |
| chart.write_text(yaml.safe_dump(data, sort_keys=False)) | |
| print("Updated", chart, "->", data["version"], data["appVersion"]) | |
| PY | |
| shell: bash | |
| - name: Helm package & push (OCI) | |
| if: steps.changes.outputs.chart == 'true' | |
| run: | | |
| helm package $CHART_DIR -d /tmp/charts | |
| helm push /tmp/charts/*.tgz oci://ghcr.io/${OWNER_LC}/charts |