diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..d808600 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,60 @@ +name: Publish to ClawHub + +on: + push: + tags: + - "v*" + +permissions: + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + environment: release + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.33.1 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 24 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + # ClawHub packs the folder with `npm pack --ignore-scripts`, so the + # compiled `dist/` must already exist on disk before publishing. + run: pnpm run build + + - name: Install ClawHub CLI + run: npm install -g clawhub@latest + + - name: Sign in to ClawHub + env: + CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }} + run: | + if [ -z "$CLAWHUB_TOKEN" ]; then + echo "::error::CLAWHUB_TOKEN secret is required to publish." + exit 1 + fi + clawhub login --token "$CLAWHUB_TOKEN" + clawhub whoami + + - name: ClawHub validate + run: clawhub package validate . + + - name: ClawHub publish (dry run) + run: clawhub package publish . --family code-plugin --dry-run + + - name: ClawHub publish + run: clawhub package publish . --family code-plugin diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..bad2452 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,53 @@ +name: Validate Plugin + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +jobs: + validate: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [22, 24] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.33.1 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Typecheck + run: pnpm run typecheck + + - name: Build + run: pnpm run build + + - name: Install ClawHub CLI + run: npm install -g clawhub@latest + + - name: ClawHub validate + run: clawhub package validate . + + - name: ClawHub publish (dry run) + run: clawhub package publish . --family code-plugin --dry-run