@@ -8,7 +8,7 @@ permissions:
88 id-token : write
99
1010jobs :
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
0 commit comments