GitHub Actions setup

Krable AI dispatches builds to scapelow5911-rgb/complit. Add this workflow file and two secrets to enable JAR compilation.

1. Add repo secrets

Go to your complit repo → Settings → Secrets and variables → Actions, and add:

SecretValue
KRABLE_CALLBACKhttps://krableai.com/api/build-callback
KRABLE_SECRETThe same token you saved as GITHUB_DISPATCH_TOKEN in Krable

2. Add the workflow file

Create .github/workflows/build-plugin.yml in the complit repo with this content:

name: Build Krable Plugin

on:
  repository_dispatch:
    types: [krable-build]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Set up JDK 21
        uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: '21'

      - name: Materialize plugin source from payload
        env:
          PAYLOAD: ${{ toJSON(github.event.client_payload) }}
        run: |
          mkdir -p plugin && cd plugin
          echo "$PAYLOAD" > /tmp/payload.json
          node -e '
            const fs=require("fs"),path=require("path");
            const p=JSON.parse(fs.readFileSync("/tmp/payload.json","utf8"));
            for (const f of p.files) {
              const d=path.join(process.cwd(), f.path);
              fs.mkdirSync(path.dirname(d),{recursive:true});
              fs.writeFileSync(d, f.content);
            }
          '

      - name: Build with Maven
        id: maven
        working-directory: plugin
        run: |
          mvn -B -ntp clean package
          echo "jar_path=$(ls target/*.jar | grep -v original | head -n1)" >> $GITHUB_OUTPUT

      - name: Upload JAR
        id: upload
        if: success()
        uses: actions/upload-artifact@v4
        with:
          name: plugin-${{ github.event.client_payload.build_id }}
          path: plugin/${{ steps.maven.outputs.jar_path }}
          retention-days: 30

      - name: Notify Krable AI (success)
        if: success()
        env:
          BUILD_ID: ${{ github.event.client_payload.build_id }}
          JAR_URL: ${{ steps.upload.outputs.artifact-url }}
          CALLBACK: ${{ secrets.KRABLE_CALLBACK }}
          SECRET: ${{ secrets.KRABLE_SECRET }}
          RUN_ID: ${{ github.run_id }}
        run: |
          curl -fsSL -X POST "$CALLBACK" \
            -H "Content-Type: application/json" \
            -H "x-krable-secret: $SECRET" \
            -d "{\"build_id\":\"$BUILD_ID\",\"status\":\"success\",\"jar_url\":\"$JAR_URL\",\"github_run_id\":$RUN_ID}"

      - name: Notify Krable AI (failure)
        if: failure()
        env:
          BUILD_ID: ${{ github.event.client_payload.build_id }}
          CALLBACK: ${{ secrets.KRABLE_CALLBACK }}
          SECRET: ${{ secrets.KRABLE_SECRET }}
          RUN_ID: ${{ github.run_id }}
        run: |
          curl -fsSL -X POST "$CALLBACK" \
            -H "Content-Type: application/json" \
            -H "x-krable-secret: $SECRET" \
            -d "{\"build_id\":\"$BUILD_ID\",\"status\":\"failed\",\"error_log\":\"Build failed — see GitHub Actions run\",\"github_run_id\":$RUN_ID}"

3. Test it

  1. Go to the dashboard and click New project.
  2. Describe a plugin and hit Generate (50 tokens).
  3. Watch the chat: AI generation → GitHub Actions compile → JAR download.
  4. If anything fails, check the run in scapelow5911-rgb/complit → Actions.

Public download URLs (optional upgrade)

By default GitHub artifact URLs require a logged-in GitHub account. To make JARs publicly downloadable, swap the upload step for a GitHub Release or push to Cloudflare R2 / Supabase Storage. Tell us when you want this and we'll wire it in.