Skip to content

Commit 45f4c1b

Browse files
authored
ci: add Hermes plugin publish workflow to main (#1443)
## Summary - Add `.github/workflows/hermes-plugin-publish.yml` to `main` so it appears in the GitHub Actions UI - The workflow itself uses `workflow_dispatch`, and when triggered the user can select which branch to run on (e.g. `openclaw-local-plugin-20260408`) ## Why GitHub only discovers `workflow_dispatch` workflows from the **default branch** (`main`). Without this, the workflow won't show up in the Actions tab even though it exists on feature branches. ## Note This PR only adds the workflow YAML file — no code changes. The actual plugin code lives on the `openclaw-local-plugin-20260408` branch.
2 parents 8fb4bb6 + ae37cd5 commit 45f4c1b

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Hermes Plugin — Build Prebuilds & Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to publish (e.g. 1.0.0 or 1.0.0-beta.1)"
8+
required: true
9+
tag:
10+
description: "npm dist-tag (latest for production, beta/next/alpha for testing)"
11+
required: true
12+
default: "latest"
13+
14+
defaults:
15+
run:
16+
working-directory: apps/memos-local-plugin
17+
18+
permissions:
19+
contents: write
20+
21+
jobs:
22+
build-prebuilds:
23+
strategy:
24+
matrix:
25+
include:
26+
- os: macos-14
27+
platform: darwin-arm64
28+
- os: macos-15
29+
platform: darwin-x64
30+
- os: ubuntu-latest
31+
platform: linux-x64
32+
- os: windows-latest
33+
platform: win32-x64
34+
runs-on: ${{ matrix.os }}
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: 22
41+
42+
- name: Install dependencies
43+
run: npm install
44+
45+
- name: Rebuild for x64 under Rosetta (darwin-x64 only)
46+
if: matrix.platform == 'darwin-x64'
47+
run: |
48+
arch -x86_64 npm rebuild better-sqlite3
49+
50+
- name: Collect prebuild
51+
shell: bash
52+
run: |
53+
mkdir -p prebuilds/${{ matrix.platform }}
54+
cp node_modules/better-sqlite3/build/Release/better_sqlite3.node prebuilds/${{ matrix.platform }}/
55+
56+
- name: Upload prebuild artifact
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: prebuild-hermes-${{ matrix.platform }}
60+
path: apps/memos-local-plugin/prebuilds/${{ matrix.platform }}/better_sqlite3.node
61+
62+
publish:
63+
needs: build-prebuilds
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
68+
- uses: actions/setup-node@v4
69+
with:
70+
node-version: 22
71+
registry-url: https://registry.npmjs.org
72+
73+
- name: Download all prebuilds
74+
uses: actions/download-artifact@v4
75+
with:
76+
path: apps/memos-local-plugin/prebuilds
77+
pattern: prebuild-hermes-*
78+
merge-multiple: false
79+
80+
- name: Organize prebuilds
81+
run: |
82+
cd prebuilds
83+
for dir in prebuild-hermes-*; do
84+
platform="${dir#prebuild-hermes-}"
85+
mkdir -p "$platform"
86+
mv "$dir/better_sqlite3.node" "$platform/"
87+
rmdir "$dir"
88+
done
89+
echo "Prebuilds collected:"
90+
find . -name "*.node" -exec ls -lh {} \;
91+
92+
- name: Install dependencies (skip native build)
93+
run: npm install --ignore-scripts
94+
95+
- name: Bump version
96+
run: npm version ${{ inputs.version }} --no-git-tag-version --allow-same-version
97+
98+
- name: Publish to npm
99+
run: npm publish --access public --tag ${{ inputs.tag }}
100+
env:
101+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
102+
103+
- name: Create git tag and push
104+
working-directory: .
105+
run: |
106+
git config user.name "github-actions[bot]"
107+
git config user.email "github-actions[bot]@users.noreply.github.com"
108+
git add apps/memos-local-plugin/package.json
109+
if ! git diff --staged --quiet; then
110+
git commit -m "release: hermes-plugin v${{ inputs.version }}"
111+
fi
112+
git tag "hermes-plugin-v${{ inputs.version }}"
113+
git push origin HEAD --tags

0 commit comments

Comments
 (0)