OpenClaw Release PR #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: OpenClaw Release PR | |
| on: | |
| schedule: | |
| - cron: "0 6 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| check-and-pr: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| - name: Get current and latest OpenClaw versions | |
| id: versions | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| current_version=$(grep -oE 'openclaw@[0-9]+(\.[0-9]+)*' Dockerfile | head -n1 | cut -d'@' -f2) | |
| all_versions=$(npm view openclaw versions --json) | |
| latest_version=$(node -e 'const versions = JSON.parse(process.argv[1]); const list = Array.isArray(versions) ? versions : [versions]; const stable = list.filter(v => !v.includes("-")); if (!stable.length) { process.exit(1); } console.log(stable[stable.length - 1]);' "$all_versions") | |
| echo "current_version=${current_version}" >> "$GITHUB_OUTPUT" | |
| echo "latest_version=${latest_version}" >> "$GITHUB_OUTPUT" | |
| if [[ "${current_version}" == "${latest_version}" ]]; then | |
| echo "update_needed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "update_needed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Update Dockerfile OpenClaw version | |
| if: steps.versions.outputs.update_needed == 'true' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| latest="${{ steps.versions.outputs.latest_version }}" | |
| sed -i -E "s|(npm install -g openclaw@)[0-9]+(\.[0-9]+)*|\\1${latest}|" Dockerfile | |
| - name: Create or update pull request | |
| if: steps.versions.outputs.update_needed == 'true' | |
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: bot/openclaw-update-${{ steps.versions.outputs.latest_version }} | |
| delete-branch: true | |
| commit-message: "chore: bump openclaw to ${{ steps.versions.outputs.latest_version }}" | |
| title: "chore: bump openclaw to ${{ steps.versions.outputs.latest_version }}" | |
| body: | | |
| Automated update for OpenClaw. | |
| - Current version: `${{ steps.versions.outputs.current_version }}` | |
| - Latest npm version: `${{ steps.versions.outputs.latest_version }}` | |
| After this PR is merged, a separate workflow tags the merge commit with `${{ steps.versions.outputs.latest_version }}` to trigger container build. | |
| labels: | | |
| openclaw-update |