OpenClaw Plugin — Build Prebuilds & Publish #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OpenClaw Plugin — Build Prebuilds & Publish | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g. 1.0.4 or 1.0.4-beta.1)" | |
| required: true | |
| tag: | |
| description: "npm dist-tag (latest for production, beta/next/alpha for testing)" | |
| required: true | |
| default: "latest" | |
| defaults: | |
| run: | |
| working-directory: apps/memos-local-openclaw | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-prebuilds: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-14 | |
| platform: darwin-arm64 | |
| - os: macos-15 | |
| platform: darwin-x64 | |
| - os: ubuntu-latest | |
| platform: linux-x64 | |
| - os: windows-latest | |
| platform: win32-x64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Rebuild for x64 under Rosetta (darwin-x64 only) | |
| if: matrix.platform == 'darwin-x64' | |
| run: | | |
| arch -x86_64 npm rebuild better-sqlite3 | |
| - name: Collect prebuild | |
| shell: bash | |
| run: | | |
| mkdir -p prebuilds/${{ matrix.platform }} | |
| cp node_modules/better-sqlite3/build/Release/better_sqlite3.node prebuilds/${{ matrix.platform }}/ | |
| - name: Upload prebuild artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: prebuild-${{ matrix.platform }} | |
| path: apps/memos-local-openclaw/prebuilds/${{ matrix.platform }}/better_sqlite3.node | |
| publish: | |
| needs: build-prebuilds | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org | |
| - name: Download all prebuilds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: apps/memos-local-openclaw/prebuilds | |
| pattern: prebuild-* | |
| merge-multiple: false | |
| - name: Organize prebuilds | |
| run: | | |
| cd prebuilds | |
| for dir in prebuild-*; do | |
| platform="${dir#prebuild-}" | |
| mkdir -p "$platform" | |
| mv "$dir/better_sqlite3.node" "$platform/" | |
| rmdir "$dir" | |
| done | |
| echo "Prebuilds collected:" | |
| find . -name "*.node" -exec ls -lh {} \; | |
| - name: Install dependencies (skip native build) | |
| run: npm install --ignore-scripts | |
| - name: Generate telemetry credentials | |
| run: node scripts/generate-telemetry-credentials.cjs | |
| env: | |
| MEMOS_ARMS_ENDPOINT: ${{ secrets.MEMOS_ARMS_ENDPOINT }} | |
| MEMOS_ARMS_PID: ${{ secrets.MEMOS_ARMS_PID }} | |
| MEMOS_ARMS_ENV: ${{ secrets.MEMOS_ARMS_ENV }} | |
| - name: Bump version | |
| run: npm version ${{ inputs.version }} --no-git-tag-version | |
| - name: Publish to npm | |
| run: npm publish --access public --tag ${{ inputs.tag }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create git tag and push | |
| working-directory: . | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add apps/memos-local-openclaw/package.json | |
| git commit -m "release: openclaw-plugin v${{ inputs.version }}" | |
| git tag "openclaw-plugin-v${{ inputs.version }}" | |
| git push origin HEAD --tags |