OpenHands Enterprise 1.2.1 release (chart 0.2.1) #22
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: | |
| validate-chart-versions: | |
| uses: ./.github/workflows/validate-chart-versions.yml | |
| with: | |
| base_ref: origin/${{ github.event.pull_request.base.ref }} | |
| enforce_version_bump: false | |
| detect-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| runtime-api: ${{ steps.changes.outputs.runtime-api }} | |
| image-loader: ${{ steps.changes.outputs.image-loader }} | |
| openhands: ${{ steps.changes.outputs.openhands }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect chart changes | |
| id: changes | |
| run: | | |
| BASE_REF="origin/${{ github.event.pull_request.base.ref }}" | |
| echo "Comparing against: $BASE_REF" | |
| # Get list of changed files | |
| CHANGED_FILES=$(git diff --name-only $BASE_REF...HEAD) | |
| echo "Changed files:" | |
| echo "$CHANGED_FILES" | |
| # Check each chart for changes | |
| for chart in runtime-api image-loader openhands; do | |
| if echo "$CHANGED_FILES" | grep -q "^charts/${chart}/"; then | |
| echo "${chart}=true" >> $GITHUB_OUTPUT | |
| echo "Changes detected in charts/${chart}" | |
| else | |
| echo "${chart}=false" >> $GITHUB_OUTPUT | |
| echo "No changes in charts/${chart}" | |
| fi | |
| done | |
| publish-charts: | |
| runs-on: ubuntu-latest | |
| needs: [validate-chart-versions, detect-changes] | |
| 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: Check if chart should be published | |
| id: check | |
| env: | |
| HAS_CHANGES_RUNTIME_API: ${{ needs.detect-changes.outputs.runtime-api }} | |
| HAS_CHANGES_IMAGE_LOADER: ${{ needs.detect-changes.outputs.image-loader }} | |
| HAS_CHANGES_OPENHANDS: ${{ needs.detect-changes.outputs.openhands }} | |
| IS_PUBLISHABLE_RUNTIME_API: ${{ needs.validate-chart-versions.outputs.runtime-api-publishable }} | |
| IS_PUBLISHABLE_IMAGE_LOADER: ${{ needs.validate-chart-versions.outputs.image-loader-publishable }} | |
| IS_PUBLISHABLE_OPENHANDS: ${{ needs.validate-chart-versions.outputs.openhands-publishable }} | |
| run: | | |
| CHART_NAME="${{ matrix.chart.name }}" | |
| case "$CHART_NAME" in | |
| runtime-api) | |
| HAS_CHANGES="$HAS_CHANGES_RUNTIME_API" | |
| IS_PUBLISHABLE="$IS_PUBLISHABLE_RUNTIME_API" | |
| ;; | |
| image-loader) | |
| HAS_CHANGES="$HAS_CHANGES_IMAGE_LOADER" | |
| IS_PUBLISHABLE="$IS_PUBLISHABLE_IMAGE_LOADER" | |
| ;; | |
| openhands) | |
| HAS_CHANGES="$HAS_CHANGES_OPENHANDS" | |
| IS_PUBLISHABLE="$IS_PUBLISHABLE_OPENHANDS" | |
| ;; | |
| esac | |
| # Default IS_PUBLISHABLE to true if not set (assume publishable unless explicitly marked otherwise) | |
| IS_PUBLISHABLE="${IS_PUBLISHABLE:-true}" | |
| echo "Chart $CHART_NAME - has changes: $HAS_CHANGES, is publishable: $IS_PUBLISHABLE" | |
| # Only publish if chart has changes AND version was bumped | |
| if [ "$HAS_CHANGES" = "true" ] && [ "$IS_PUBLISHABLE" = "true" ]; then | |
| echo "should_publish=true" >> $GITHUB_OUTPUT | |
| echo "✅ Chart $CHART_NAME will be published" | |
| else | |
| echo "should_publish=false" >> $GITHUB_OUTPUT | |
| if [ "$HAS_CHANGES" != "true" ]; then | |
| echo "⏭️ Chart $CHART_NAME skipped - no changes" | |
| else | |
| echo "⏭️ Chart $CHART_NAME skipped - version not bumped" | |
| fi | |
| fi | |
| - name: Checkout | |
| if: steps.check.outputs.should_publish == 'true' | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Helm | |
| if: steps.check.outputs.should_publish == 'true' | |
| uses: azure/setup-helm@v3 | |
| with: | |
| version: 'latest' | |
| - name: Use PR version suffix | |
| if: steps.check.outputs.should_publish == 'true' | |
| run: | | |
| # Create a preview version like 0.1.0-alpha.123 | |
| # This should confirm to SemVer, the last number is the GitHub PR number | |
| CHART_VERSION=$(yq '.version' charts/${{ matrix.chart.name }}/Chart.yaml) | |
| PREVIEW_VERSION="${CHART_VERSION}-alpha.${{ 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: steps.check.outputs.should_publish == 'true' && matrix.chart.name == 'openhands' && needs.detect-changes.outputs.runtime-api == 'true' | |
| run: | | |
| RUNTIME_API_VERSION=$(yq '.version' charts/runtime-api/Chart.yaml) | |
| RUNTIME_API_PREVIEW="${RUNTIME_API_VERSION}-alpha.${{ 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 | |
| if: steps.check.outputs.should_publish == 'true' | |
| 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 | |
| if: steps.check.outputs.should_publish == 'true' | |
| 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}" | |
| # Ensure we are publishing to an "alpha" version. | |
| if [[ "$VERSION" != *alpha* ]]; then | |
| echo "Error: Version '$VERSION' does not contain 'alpha'" | |
| exit 1 | |
| fi | |
| # 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 | |
| if: steps.check.outputs.should_publish == 'true' | |
| 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 }} |