PLTF-19: Automate updating OpenHands and runtime-api charts for enterprise release #17
Workflow file for this run
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: Preview Helm Charts | |
| on: | |
| pull_request: | |
| paths: | |
| - 'charts/**' | |
| jobs: | |
| publish-charts: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| matrix: | |
| chart: | |
| - name: runtime-api | |
| path: charts/runtime-api | |
| - name: image-loader | |
| path: charts/image-loader | |
| - name: openhands | |
| path: charts/openhands | |
| max-parallel: 1 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Helm | |
| uses: azure/setup-helm@v3 | |
| with: | |
| version: 'latest' | |
| - name: Use PR version suffix | |
| run: | | |
| # Create a preview version like 0.1.0-pr-123 | |
| CHART_VERSION=$(yq '.version' charts/${{ matrix.chart.name }}/Chart.yaml) | |
| PREVIEW_VERSION="${CHART_VERSION}-pr-${{ github.event.pull_request.number }}" | |
| # Update Chart.yaml with preview version | |
| yq -i ".version = \"${PREVIEW_VERSION}\"" charts/${{ matrix.chart.name }}/Chart.yaml | |
| - name: Update runtime-api dependency version | |
| if: matrix.chart.name == 'openhands' | |
| run: | | |
| RUNTIME_API_VERSION=$(yq '.version' charts/runtime-api/Chart.yaml) | |
| RUNTIME_API_PREVIEW="${RUNTIME_API_VERSION}-pr-${{ github.event.pull_request.number }}" | |
| yq -i "(.dependencies[] | select(.name == \"runtime-api\")).version = \"${RUNTIME_API_PREVIEW}\"" charts/openhands/Chart.yaml | |
| helm dependency update charts/openhands | |
| - name: Test ${{ matrix.chart.name }} chart with default values | |
| run: | | |
| echo "Testing ${{ matrix.chart.name }} chart with default values" | |
| echo "Updating dependencies for ${{ matrix.chart.name }}" | |
| helm dependency update ${{ matrix.chart.path }} | |
| echo "Running helm lint for ${{ matrix.chart.name }}" | |
| helm lint ${{ matrix.chart.path }} | |
| if [ $? -ne 0 ]; then | |
| echo "Helm lint test failed for ${{ matrix.chart.name }}" | |
| exit 1 | |
| fi | |
| echo "Helm lint test passed for ${{ matrix.chart.name }}" | |
| echo "Running helm template for ${{ matrix.chart.name }}" | |
| helm template ${{ matrix.chart.path }} --debug | |
| if [ $? -ne 0 ]; then | |
| echo "Helm template test failed for ${{ matrix.chart.name }}" | |
| exit 1 | |
| fi | |
| echo "Helm template test passed for ${{ matrix.chart.name }}" | |
| - name: Extract chart version and prepare repository | |
| id: chart_info | |
| run: | | |
| VERSION=$(grep '^version:' ${{ matrix.chart.path }}/Chart.yaml | awk '{print $2}') | |
| echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "Using chart version: ${VERSION}" | |
| # Convert repository owner to lowercase for GHCR | |
| REPO_OWNER=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
| echo "REPO_OWNER=${REPO_OWNER}" >> $GITHUB_OUTPUT | |
| echo "Using repository owner: ${REPO_OWNER}" | |
| - name: Publish ${{ matrix.chart.name }} chart to GHCR | |
| uses: appany/helm-oci-chart-releaser@v0.4.2 | |
| with: | |
| name: ${{ matrix.chart.name }} | |
| repository: helm-charts | |
| path: ${{ matrix.chart.path }} | |
| registry: ghcr.io/${{ steps.chart_info.outputs.REPO_OWNER }} | |
| registry_username: ${{ github.actor }} | |
| registry_password: ${{ secrets.GITHUB_TOKEN }} | |
| update_dependencies: 'true' | |
| tag: ${{ steps.chart_info.outputs.VERSION }} |