Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,48 @@ on:
push:
tags:
- "*"
workflow_run:
workflows:
- "Tag OpenClaw Version On Merge"
types:
- completed

jobs:
build:
if: github.event_name == 'push' || github.event.workflow_run.conclusion == 'success'
name: Build and push to GitHub Container Registry
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Set TAG
- name: Checkout (workflow_run)
if: github.event_name == 'workflow_run'
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0

- name: Checkout (push tag)
if: github.event_name == 'push'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set TAG from workflow_run commit
if: github.event_name == 'workflow_run'
shell: bash
run: |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
set -euo pipefail
tag=$(grep -oE 'openclaw@[0-9]+(\.[0-9]+)*' Dockerfile | head -n1 | cut -d'@' -f2)
echo "TAG=${tag}" >> "$GITHUB_ENV"

- uses: actions/checkout@v4
- name: Set TAG from pushed ref
if: github.event_name == 'push'
shell: bash
run: |
set -euo pipefail
echo "TAG=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"

- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.repository_owner }}" --password-stdin
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/openclaw-release-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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@v6
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
47 changes: 47 additions & 0 deletions .github/workflows/tag-on-openclaw-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Tag OpenClaw Version On Merge

on:
pull_request_target:
types:
- closed

jobs:
tag-merged-pr:
if: >-
github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == github.event.repository.default_branch &&
contains(github.event.pull_request.labels.*.name, 'openclaw-update') &&
startsWith(github.event.pull_request.head.ref, 'bot/openclaw-update-')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout merge commit
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: 0

- name: Read OpenClaw version from Dockerfile
id: version
shell: bash
run: |
set -euo pipefail
version=$(grep -oE 'openclaw@[0-9]+(\.[0-9]+)*' Dockerfile | head -n1 | cut -d'@' -f2)
echo "version=${version}" >> "$GITHUB_OUTPUT"

- name: Create tag if missing
shell: bash
run: |
set -euo pipefail
version="${{ steps.version.outputs.version }}"

git fetch --tags

if git rev-parse -q --verify "refs/tags/${version}" >/dev/null; then
echo "Tag ${version} already exists; nothing to do."
exit 0
fi

git tag "${version}" "${{ github.event.pull_request.merge_commit_sha }}"
git push origin "${version}"
Loading