Skip to content

Commit 23cb6d1

Browse files
committed
Use official ClawHub publish workflow
1 parent 87b671a commit 23cb6d1

3 files changed

Lines changed: 13 additions & 64 deletions

File tree

.github/workflows/clawhub-publish.yml

Lines changed: 10 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permissions:
88
id-token: write
99

1010
jobs:
11-
publish:
11+
validate:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Check out repository
@@ -31,64 +31,12 @@ jobs:
3131
- name: Dry-run ClawHub package
3232
run: npm run clawhub:dry-run
3333

34-
- name: Validate trusted publisher OIDC
35-
run: |
36-
node --input-type=module <<'NODE'
37-
const pkg = await import("./package.json", { with: { type: "json" } });
38-
const requestUrl = process.env.ACTIONS_ID_TOKEN_REQUEST_URL;
39-
const requestToken = process.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN;
40-
if (!requestUrl || !requestToken) {
41-
throw new Error("GitHub Actions OIDC environment is not available.");
42-
}
43-
44-
const oidcUrl = new URL(requestUrl);
45-
oidcUrl.searchParams.set("audience", "clawhub");
46-
const oidcResponse = await fetch(oidcUrl, {
47-
headers: { Authorization: `Bearer ${requestToken}` },
48-
});
49-
const oidcBody = await oidcResponse.json();
50-
if (!oidcResponse.ok || !oidcBody.value) {
51-
throw new Error(`GitHub OIDC request failed: ${oidcResponse.status}`);
52-
}
53-
54-
const token = oidcBody.value;
55-
const [, payload] = token.split(".");
56-
const claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
57-
console.log("OIDC claims:", JSON.stringify({
58-
aud: claims.aud,
59-
repository: claims.repository,
60-
repository_id: claims.repository_id,
61-
repository_owner: claims.repository_owner,
62-
repository_owner_id: claims.repository_owner_id,
63-
workflow: claims.workflow,
64-
workflow_ref: claims.workflow_ref,
65-
job_workflow_ref: claims.job_workflow_ref,
66-
ref: claims.ref,
67-
sha: claims.sha,
68-
}, null, 2));
69-
70-
const mintResponse = await fetch("https://clawhub.ai/api/v1/publish/token/mint", {
71-
method: "POST",
72-
headers: {
73-
Accept: "application/json",
74-
"Content-Type": "application/json",
75-
},
76-
body: JSON.stringify({
77-
packageName: pkg.default.name,
78-
version: pkg.default.version,
79-
githubOidcToken: token,
80-
}),
81-
});
82-
const mintText = await mintResponse.text();
83-
console.log(`ClawHub mint status: ${mintResponse.status}`);
84-
if (!mintResponse.ok) {
85-
console.log(mintText);
86-
process.exit(1);
87-
}
88-
console.log("ClawHub trusted publisher token mint succeeded.");
89-
NODE
90-
91-
- name: Publish ClawHub package
92-
env:
93-
GH_TOKEN: ${{ github.token }}
94-
run: npm run clawhub:publish
34+
publish:
35+
needs: validate
36+
permissions:
37+
contents: read
38+
id-token: write
39+
uses: openclaw/clawhub/.github/workflows/package-publish.yml@v0.12.0
40+
with:
41+
dry_run: false
42+
tags: latest,mautic,marketing-automation,crm,webhooks,openclaw

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 0.1.8 - 2026-05-26
44

55
- Added GitHub Actions OIDC trusted publishing for ClawHub.
6-
- Added a manual ClawHub publish workflow that runs lint, tests, package validation, dry run, and publish.
6+
- Added a manual ClawHub publish workflow that validates locally, then calls ClawHub's official reusable publish workflow.
77
- Documented trusted publisher configuration and verification.
88

99
## 0.1.7 - 2026-05-26

docs/TRUSTED_PUBLISHING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ Run the workflow manually from GitHub Actions:
1717
gh workflow run clawhub-publish.yml --ref main
1818
```
1919

20-
The workflow:
20+
The caller workflow:
2121

2222
- checks out the repository
2323
- sets up Node.js 24
2424
- runs lint, tests, and package validation
2525
- runs a ClawHub dry run
26+
- delegates the final publish job to ClawHub's official reusable workflow
2627
- publishes through ClawHub using GitHub Actions OIDC
2728

2829
No long-lived ClawHub token is stored in the repository or GitHub Actions secrets.

0 commit comments

Comments
 (0)