ci: add pkg.pr.new previews (#95)

This commit is contained in:
_Kerman 2026-05-27 17:09:33 +08:00 committed by GitHub
parent 2e8c417818
commit 8b5065c08b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 60 additions and 0 deletions

50
.github/workflows/pkg-pr-new.yml vendored Normal file
View file

@ -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'

View file

@ -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",

9
pnpm-lock.yaml generated
View file

@ -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: