Update Base Image #194
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: Update Base Image | |
| on: | |
| schedule: | |
| # Run daily at 00:00 UTC | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| check-and-update: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Git | |
| run: | | |
| git config --global user.name 'github-actions[bot]' | |
| git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
| - name: Check for new version | |
| id: check-version | |
| run: | | |
| # Get the latest OpenHands release version | |
| LATEST_VERSION=$(curl -s "https://api.github.com/repos/All-Hands-AI/OpenHands/releases/latest" | jq -r '.tag_name') | |
| echo "Latest version: $LATEST_VERSION" | |
| # Extract current version from Dockerfile | |
| CURRENT_VERSION=$(grep -E '^FROM ghcr.io/all-hands-ai/runtime:' Dockerfile | sed -E 's/.*:([0-9]+\.[0-9]+)-nikolaik/\1/') | |
| echo "Current version: $CURRENT_VERSION" | |
| # Extract major.minor from latest version (remove 'v' prefix if exists) | |
| LATEST_MINOR=$(echo $LATEST_VERSION | sed 's/^v//' | cut -d. -f1,2) | |
| # Compare versions | |
| if [ "$CURRENT_VERSION" != "$LATEST_MINOR" ]; then | |
| echo "New version available: $LATEST_MINOR" | |
| echo "update_needed=true" >> $GITHUB_OUTPUT | |
| echo "new_version=$LATEST_MINOR" >> $GITHUB_OUTPUT | |
| echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| else | |
| echo "Already up to date" | |
| echo "update_needed=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Update Dockerfile | |
| if: steps.check-version.outputs.update_needed == 'true' | |
| run: | | |
| NEW_VERSION="${{ steps.check-version.outputs.new_version }}" | |
| CURRENT_VERSION="${{ steps.check-version.outputs.current_version }}" | |
| # Update Dockerfile | |
| sed -i "s/FROM ghcr.io\/all-hands-ai\/runtime:${CURRENT_VERSION}-nikolaik/FROM ghcr.io\/all-hands-ai\/runtime:${NEW_VERSION}-nikolaik/" Dockerfile | |
| # Update CLAUDE.md if it exists | |
| if [ -f CLAUDE.md ]; then | |
| sed -i "s/runtime:${CURRENT_VERSION}-nikolaik/runtime:${NEW_VERSION}-nikolaik/g" CLAUDE.md | |
| fi | |
| - name: Create Pull Request | |
| if: steps.check-version.outputs.update_needed == 'true' | |
| uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "chore: update OpenHands runtime to ${{ steps.check-version.outputs.new_version }}" | |
| title: "Update OpenHands runtime to ${{ steps.check-version.outputs.new_version }}" | |
| body: | | |
| ## Description | |
| This PR updates the OpenHands runtime base image from version `${{ steps.check-version.outputs.current_version }}` to `${{ steps.check-version.outputs.new_version }}`. | |
| ### Changes | |
| - Updated `FROM` instruction in Dockerfile to use `ghcr.io/all-hands-ai/runtime:${{ steps.check-version.outputs.new_version }}-nikolaik` | |
| - Updated version references in documentation (if applicable) | |
| ### Notes | |
| - This update was automatically generated by the daily version check workflow | |
| - Please review the [OpenHands releases](https://github.com/All-Hands-AI/OpenHands/releases) for any breaking changes | |
| --- | |
| *This PR was automatically created by GitHub Actions* | |
| branch: update-runtime-${{ steps.check-version.outputs.new_version }} | |
| delete-branch: true | |
| labels: | | |
| dependencies | |
| automated |