-
Notifications
You must be signed in to change notification settings - Fork 12
176 lines (155 loc) · 6.3 KB
/
Copy pathopenclaw-release.yml
File metadata and controls
176 lines (155 loc) · 6.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Build OpenClaw Image
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
openclawTag:
default: "2026.7.1"
description: "OpenClaw release and Docker Hub tag, for example 2026.7.1"
required: true
pushLatest:
description: "Push latest tag"
default: "true"
required: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
IMAGE_NAME: 1panel/openclaw
jobs:
resolve:
runs-on: ubuntu-24.04
outputs:
openclaw_tag: ${{ steps.meta.outputs.openclaw_tag }}
dockerhub_tag: ${{ steps.meta.outputs.dockerhub_tag }}
push_latest: ${{ steps.meta.outputs.push_latest }}
steps:
- name: Resolve release metadata
id: meta
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
INPUT_OPENCLAW_TAG: ${{ github.event.inputs.openclawTag }}
INPUT_PUSH_LATEST: ${{ github.event.inputs.pushLatest }}
REF_NAME: ${{ github.ref_name }}
run: |
set -euo pipefail
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
openclaw_tag="${INPUT_OPENCLAW_TAG}"
push_latest="${INPUT_PUSH_LATEST:-true}"
else
openclaw_tag="${REF_NAME#v}"
push_latest="true"
fi
if [ -z "$openclaw_tag" ]; then
echo "::error::Failed to resolve OpenClaw tag"
exit 1
fi
{
echo "openclaw_tag=$openclaw_tag"
echo "dockerhub_tag=$openclaw_tag"
echo "push_latest=$push_latest"
} >> "$GITHUB_OUTPUT"
build-amd64:
needs: resolve
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Download Source
run: |
set -euo pipefail
mkdir -p _src/openclaw
curl -fsSL "https://github.com/openclaw/openclaw/archive/refs/tags/v${{ needs.resolve.outputs.openclaw_tag }}.tar.gz" \
| tar -xz -C _src/openclaw --strip-components=1
test -d _src/openclaw/packages || { echo "::error::OpenClaw source is missing packages/. Check openclawTag matches this Dockerfile."; exit 1; }
test -f _src/openclaw/scripts/prune-docker-plugin-dist.mjs || { echo "::error::OpenClaw source is missing scripts/prune-docker-plugin-dist.mjs. Check openclawTag matches this Dockerfile."; exit 1; }
test -d _src/openclaw/extensions/canvas/src/host || { echo "::error::OpenClaw source is missing extensions/canvas/src/host/. Check openclawTag matches this Dockerfile."; exit 1; }
mkdir -p _src/openclaw/openclaw
cp openclaw/Dockerfile openclaw/docker-entrypoint.sh _src/openclaw/openclaw/
- name: Build and push amd64 image
uses: docker/build-push-action@v7
with:
context: _src/openclaw
file: _src/openclaw/openclaw/Dockerfile
platforms: linux/amd64
push: true
build-args: |
OPENCLAW_INSTALL_BROWSER=true
tags: |
${{ env.IMAGE_NAME }}:${{ needs.resolve.outputs.dockerhub_tag }}-amd64
cache-from: type=gha,scope=openclaw-amd64
cache-to: type=gha,mode=max,scope=openclaw-amd64
build-arm64:
needs: resolve
runs-on: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Download Source
run: |
set -euo pipefail
mkdir -p _src/openclaw
curl -fsSL "https://github.com/openclaw/openclaw/archive/refs/tags/v${{ needs.resolve.outputs.openclaw_tag }}.tar.gz" \
| tar -xz -C _src/openclaw --strip-components=1
test -d _src/openclaw/packages || { echo "::error::OpenClaw source is missing packages/. Check openclawTag matches this Dockerfile."; exit 1; }
test -f _src/openclaw/scripts/prune-docker-plugin-dist.mjs || { echo "::error::OpenClaw source is missing scripts/prune-docker-plugin-dist.mjs. Check openclawTag matches this Dockerfile."; exit 1; }
test -d _src/openclaw/extensions/canvas/src/host || { echo "::error::OpenClaw source is missing extensions/canvas/src/host/. Check openclawTag matches this Dockerfile."; exit 1; }
mkdir -p _src/openclaw/openclaw
cp openclaw/Dockerfile openclaw/docker-entrypoint.sh _src/openclaw/openclaw/
- name: Build and push arm64 image
uses: docker/build-push-action@v7
with:
context: _src/openclaw
file: _src/openclaw/openclaw/Dockerfile
platforms: linux/arm64
push: true
build-args: |
OPENCLAW_INSTALL_BROWSER=true
tags: |
${{ env.IMAGE_NAME }}:${{ needs.resolve.outputs.dockerhub_tag }}-arm64
cache-from: type=gha,scope=openclaw-arm64
cache-to: type=gha,mode=max,scope=openclaw-arm64
create-manifest:
needs: [resolve, build-amd64, build-arm64]
runs-on: ubuntu-24.04
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Create and push multi-platform manifest
shell: bash
env:
IMAGE: ${{ env.IMAGE_NAME }}
TAG: ${{ needs.resolve.outputs.dockerhub_tag }}
PUSH_LATEST: ${{ needs.resolve.outputs.push_latest }}
run: |
set -euo pipefail
docker buildx imagetools create \
-t "${IMAGE}:${TAG}" \
"${IMAGE}:${TAG}-amd64" \
"${IMAGE}:${TAG}-arm64"
if [ "$PUSH_LATEST" = "true" ]; then
docker buildx imagetools create \
-t "${IMAGE}:latest" \
"${IMAGE}:${TAG}-amd64" \
"${IMAGE}:${TAG}-arm64"
fi