Skip to content

Commit 16a11cf

Browse files
hcastc00claude
andauthored
Refactor to install from npm instead of building from git (#15)
* Refactor to install from npm instead of building from git * Bump openclaw upstream to 2026.3.2 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: use dappnodesdk bump-upstream and add Pinata secrets for IPFS hash comments Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: remove build-test job from main.yml, rely on bump-upstream for hash comments Hash comments are posted by auto_check.yml via dappnodesdk bump-upstream. The build-test job was causing ENOTFOUND failures on the ipfs-dev-gateway runner. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: restore build-test job for PR checks using working build command Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * ci: add build-hash job on ubuntu-latest for IPFS hash comments on all PRs Separates concerns: - build-test: ipfs-dev-gateway, PR events only, verifies Docker build - build-hash: ubuntu-latest, push to non-main branches, posts IPFS hash via Pinata - release: ipfs-dev-gateway, push to main only Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix CI: use github-action build for IPFS hash comments on PRs - Remove build-test job (build-hash serves as both test and hash poster) - Remove pull_request trigger (only push events needed) - Fix command: 'github-action build' instead of 'build github-action build' (the wrong command was calling the build subcommand with provider defaulting to dappnode, causing ENOTFOUND errors; the correct subcommand uses Pinata) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 33e1f19 commit 16a11cf

File tree

9 files changed

+30
-110
lines changed

9 files changed

+30
-110
lines changed

.github/workflows/auto_check.yml

Lines changed: 6 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -10,73 +10,11 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
- uses: actions/setup-node@v4
1314
with:
14-
submodules: true
15-
fetch-depth: 0
16-
17-
- name: Get current submodule commit
18-
id: current
19-
run: echo "sha=$(git -C openclaw rev-parse HEAD)" >> "$GITHUB_OUTPUT"
20-
21-
- name: Fetch latest upstream release
22-
id: upstream
15+
node-version: "22"
16+
- run: npx @dappnode/dappnodesdk github-action bump-upstream
2317
env:
24-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
run: |
26-
LATEST=$(gh api repos/openclaw/openclaw/releases/latest --jq '.tag_name')
27-
echo "tag=$LATEST" >> "$GITHUB_OUTPUT"
28-
# Strip leading 'v' if present for the version string
29-
VERSION="${LATEST#v}"
30-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
31-
32-
- name: Update submodule to latest release
33-
id: update
34-
run: |
35-
cd openclaw
36-
git fetch --tags origin
37-
git checkout ${{ steps.upstream.outputs.tag }}
38-
cd ..
39-
NEW_SHA=$(git -C openclaw rev-parse HEAD)
40-
echo "sha=$NEW_SHA" >> "$GITHUB_OUTPUT"
41-
42-
- name: Check if update is needed
43-
id: check
44-
run: |
45-
if [ "${{ steps.current.outputs.sha }}" = "${{ steps.update.outputs.sha }}" ]; then
46-
echo "changed=false" >> "$GITHUB_OUTPUT"
47-
else
48-
echo "changed=true" >> "$GITHUB_OUTPUT"
49-
fi
50-
51-
- name: Update upstream version in dappnode_package.json
52-
if: steps.check.outputs.changed == 'true'
53-
run: |
54-
VERSION=${{ steps.upstream.outputs.version }}
55-
jq --arg v "$VERSION" '.upstreamVersion = $v' dappnode_package.json > tmp.json && mv tmp.json dappnode_package.json
56-
57-
- name: Create PR
58-
if: steps.check.outputs.changed == 'true'
59-
env:
60-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61-
run: |
62-
VERSION=${{ steps.upstream.outputs.version }}
63-
BRANCH="bump-upstream/v${VERSION}"
64-
65-
git config user.name "github-actions[bot]"
66-
git config user.email "github-actions[bot]@users.noreply.github.com"
67-
68-
# Check if branch already exists on remote
69-
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
70-
echo "Branch $BRANCH already exists, skipping"
71-
exit 0
72-
fi
73-
74-
git checkout -b "$BRANCH"
75-
git add openclaw dappnode_package.json
76-
git commit -m "Bump openclaw upstream to ${VERSION}"
77-
git push origin "$BRANCH"
78-
79-
gh pr create \
80-
--title "Bump openclaw upstream to ${VERSION}" \
81-
--body "Bumps openclaw submodule to release \`${{ steps.upstream.outputs.tag }}\`." \
82-
--base main
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
20+
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }}

.github/workflows/main.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
11
name: "Main"
22
on:
33
repository_dispatch:
4-
pull_request:
54
push:
6-
branches:
7-
- "main"
8-
- "v[0-9]+.[0-9]+.[0-9]+"
95
paths-ignore:
106
- "README.md"
117

128
jobs:
13-
build-test:
14-
runs-on: ipfs-dev-gateway
15-
name: Build test
16-
if: github.event_name != 'push'
9+
build-hash:
10+
runs-on: ubuntu-latest
11+
name: Build and post IPFS hash
12+
if: github.event_name == 'push' && github.ref != 'refs/heads/main'
1713
steps:
1814
- uses: actions/checkout@v4
19-
with:
20-
submodules: true
2115
- uses: actions/setup-node@v4
2216
with:
2317
node-version: "22"
24-
- run: npx @dappnode/dappnodesdk build --provider http://10.200.200.7:5001 --timeout 1h
18+
- run: npx @dappnode/dappnodesdk github-action build
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
PINATA_API_KEY: ${{ secrets.PINATA_API_KEY }}
22+
PINATA_SECRET_API_KEY: ${{ secrets.PINATA_SECRET_API_KEY }}
2523

2624
release:
2725
name: Release
2826
runs-on: ipfs-dev-gateway
29-
if: github.event_name == 'push' || github.event_name == 'repository_dispatch'
27+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'repository_dispatch'
3028
steps:
3129
- uses: actions/checkout@v4
32-
with:
33-
submodules: true
3430
- uses: actions/setup-node@v4
3531
with:
3632
node-version: "22"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Former git submodule (now installed via npm at build time)
2+
openclaw/
3+
14
# Build artifacts
25
build_*/
36
*.xz

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

Dockerfile

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ ARG UPSTREAM_VERSION="latest"
22

33
FROM node:22-bookworm
44

5-
# Install Bun (required for build scripts) and sudo (needed by openclaw tool executor)
5+
# Install Bun (required by openclaw at runtime) and sudo (needed by openclaw tool executor)
66
RUN curl -fsSL https://bun.sh/install | bash && \
77
apt-get update && \
88
apt-get install -y --no-install-recommends sudo && \
99
apt-get clean && \
1010
rm -rf /var/lib/apt/lists/*
1111
ENV PATH="/root/.bun/bin:${PATH}"
1212

13-
RUN corepack enable
14-
1513
WORKDIR /app
1614

1715
ARG OPENCLAW_DOCKER_APT_PACKAGES=""
@@ -22,21 +20,11 @@ RUN if [ -n "$OPENCLAW_DOCKER_APT_PACKAGES" ]; then \
2220
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*; \
2321
fi
2422

25-
COPY openclaw/package.json openclaw/pnpm-lock.yaml openclaw/pnpm-workspace.yaml openclaw/.npmrc ./
26-
COPY openclaw/ui/package.json ./ui/package.json
27-
COPY openclaw/patches ./patches
28-
COPY openclaw/scripts ./scripts
29-
30-
RUN pnpm install --frozen-lockfile
31-
32-
COPY openclaw/ .
33-
RUN OPENCLAW_A2UI_SKIP_MISSING=1 pnpm build
34-
# Force pnpm for UI build (Bun may fail on ARM/Synology architectures)
35-
ENV OPENCLAW_PREFER_PNPM=1
36-
RUN pnpm ui:build
23+
ARG UPSTREAM_VERSION
24+
RUN npm install -g openclaw@${UPSTREAM_VERSION}
3725

38-
# Make the openclaw CLI available in PATH
39-
RUN ln -s /app/openclaw.mjs /usr/local/bin/openclaw
26+
# Make json5 (openclaw dependency) resolvable by plain require('json5')
27+
ENV NODE_PATH=/usr/local/lib/node_modules
4028

4129
ENV NODE_ENV=production
4230

@@ -66,4 +54,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
6654

6755
# Run as root (no-new-privileges prevents privilege escalation via gosu/sudo)
6856
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
69-
CMD ["node", "dist/index.js", "gateway", "--allow-unconfigured"]
57+
CMD ["openclaw", "gateway", "--allow-unconfigured"]

dappnode_package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "openclaw.dnp.dappnode.eth",
33
"version": "0.1.0",
4-
"upstreamVersion": "2026.3.1",
4+
"upstreamVersion": "2026.3.2",
55
"upstreamRepo": "openclaw/openclaw",
66
"upstreamArg": "UPSTREAM_VERSION",
77
"shortDescription": "Personal AI assistant gateway with multi-LLM support",
@@ -89,4 +89,4 @@
8989
"featuredBackground": "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
9090
"featuredColor": "white"
9191
}
92-
}
92+
}

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services:
55
context: .
66
dockerfile: Dockerfile
77
args:
8-
UPSTREAM_VERSION: "latest"
8+
UPSTREAM_VERSION: "2026.3.2"
99
image: "openclaw.dnp.dappnode.eth:0.1.0"
1010
container_name: DAppNodePackage-openclaw.dnp.dappnode.eth
1111
restart: unless-stopped
@@ -26,8 +26,7 @@ services:
2626
max-size: "10m"
2727
max-file: "3"
2828
command:
29-
- "node"
30-
- "dist/index.js"
29+
- "openclaw"
3130
- "gateway"
3231
- "--allow-unconfigured"
3332

entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ EOF
2929
else
3030
node -e "
3131
const fs = require('fs');
32-
const JSON5 = require('/app/node_modules/json5');
32+
const JSON5 = require('json5');
3333
const configPath = '$CONFIG_FILE';
3434
try {
3535
const config = JSON5.parse(fs.readFileSync(configPath, 'utf8'));

openclaw

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)