diff --git a/.github/workflows/pkg-pr-new.yml b/.github/workflows/pkg-pr-new.yml new file mode 100644 index 000000000..86de76975 --- /dev/null +++ b/.github/workflows/pkg-pr-new.yml @@ -0,0 +1,50 @@ +name: pkg.pr.new + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + publish: + name: Publish Kimi Code preview + runs-on: ubuntu-latest + if: github.repository_owner == 'MoonshotAI' && github.event.pull_request.draft == false + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup pnpm + uses: pnpm/action-setup@v6 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: .nvmrc + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build package dependencies + run: pnpm run build:packages + + - name: Generate Kimi Code built-in catalog + shell: bash + run: | + CATALOG_FILE="$RUNNER_TEMP/kimi-code-built-in-catalog.json" + node apps/kimi-code/scripts/update-catalog.mjs --out "$CATALOG_FILE" + echo "KIMI_CODE_BUILT_IN_CATALOG_FILE=$CATALOG_FILE" >> "$GITHUB_ENV" + + - name: Build Kimi Code package + run: pnpm --filter @moonshot-ai/kimi-code run build + + - name: Publish pkg.pr.new preview + run: pnpm exec pkg-pr-new publish --bin --commentWithSha --packageManager=pnpm,npm --no-template './apps/kimi-code' diff --git a/package.json b/package.json index a3ba656e3..f5dd4f5cb 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "lint-staged": "16.4.0", "oxlint": "1.59.0", "oxlint-tsgolint": "0.20.0", + "pkg-pr-new": "0.0.75", "publint": "0.3.18", "sherif": "1.11.1", "simple-git-hooks": "2.13.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2cf82249d..307dee36b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -45,6 +45,9 @@ importers: oxlint-tsgolint: specifier: 0.20.0 version: 0.20.0 + pkg-pr-new: + specifier: 0.0.75 + version: 0.0.75 publint: specifier: 0.3.18 version: 0.3.18 @@ -3399,6 +3402,10 @@ packages: resolution: {integrity: sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==} engines: {node: '>=16.20.0'} + pkg-pr-new@0.0.75: + resolution: {integrity: sha512-u9mdErTewKSMsr+ceCt8VcNuNP0ro5AXiPXhUVApuEyqr2Zlvt+DdCFBcm+yGWN8mhOdZJ27meIDbnoZgfzpOw==} + hasBin: true + possible-typed-array-names@1.1.0: resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} engines: {node: '>= 0.4'} @@ -7069,6 +7076,8 @@ snapshots: pkce-challenge@5.0.1: {} + pkg-pr-new@0.0.75: {} + possible-typed-array-names@1.1.0: {} postcss@8.5.9: