Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ on:
inputs:
tag:
description: "要发布的 tag(如 @sfmc-bds/sdk@v0.1.0)"
required: true
# 勿 required:true:改本 workflow 的 branch push 会被 GHA 误评估,
# 缺 inputs 时出现空 jobs + "workflow file issue" failure(见 run 29922880511)。
required: false
type: string

jobs:
publish:
# dispatch 放行;push 仅真实 tag 且 @sfmc-bds/ 前缀才跑。
# ref_type==tag 防御误触的 branch push(skipped 绿,而非空 jobs 红)。
if: >-
github.event_name == 'workflow_dispatch' ||
startsWith(github.ref_name, '@sfmc-bds/')
(github.ref_type == 'tag' && startsWith(github.ref_name, '@sfmc-bds/'))
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -56,7 +60,8 @@ jobs:

- name: build target workspace
if: steps.meta.outputs.already_published != 'true'
run: npm run build --workspace "${{ steps.meta.outputs.workspace }}"
# --if-present: 允许无编译步骤的纯 JS/mjs 包(如 @sfmc-bds/tools)
run: npm run build --workspace "${{ steps.meta.outputs.workspace }}" --if-present

- name: publish to npm
if: steps.meta.outputs.already_published != 'true'
Expand Down
15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"module-core:typecheck": "npm run sdk:typecheck",
"module-core:test": "echo \"no sdk tests yet\"",
"module-core:verify": "npm run sdk:verify",
"pack:verify": "npm run build --workspaces --if-present && npm pack -w @sfmc-bds/sdk && npm pack -w @sfmc-bds/cli && npm pack -w @sfmc-bds/db-server && npm pack -w @sfmc-bds/qq-bridge && npm pack -w @sfmc-bds/bds-tools",
"pack:verify": "npm run build --workspaces --if-present && npm pack -w @sfmc-bds/sdk && npm pack -w @sfmc-bds/cli && npm pack -w @sfmc-bds/db-server && npm pack -w @sfmc-bds/qq-bridge && npm pack -w @sfmc-bds/bds-tools && npm pack -w @sfmc-bds/tools",
"check-modules": "node tools/check-modules.mjs",
"catalog-sync": "node tools/catalog-sync.mjs",
"check-ootb": "node tools/check-ootb.mjs",
Expand All @@ -56,7 +56,8 @@
"qq-bridge",
"bds-tools",
"sfmc",
"remote-controller"
"remote-controller",
"tools"
],
"engines": {
"node": ">=22.13.0"
Expand Down
1 change: 1 addition & 0 deletions tools/lib/npm-publish-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const NPM_PUBLISH_PACKAGES = {
"@sfmc-bds/db-server": "db-server/package.json",
"@sfmc-bds/qq-bridge": "qq-bridge/package.json",
"@sfmc-bds/bds-tools": "bds-tools/package.json",
"@sfmc-bds/tools": "tools/package.json",
};

/** @returns {keyof typeof NPM_PUBLISH_PACKAGES | null} */
Expand Down
15 changes: 13 additions & 2 deletions tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,22 @@
"tools",
"scriptsforminecraftserver"
],
"main": "check-ootb.js",
"main": "check-ootb.mjs",
"files": [
"./*",
"*.mjs",
"lib",
"README.md"
],
"scripts": {
"build": "node -e \"process.exit(0)\"",
"check-ootb": "node check-ootb.mjs",
"check-modules": "node check-modules.mjs",
"catalog-sync": "node catalog-sync.mjs",
"smoke-modules": "node smoke-modules.mjs"
},
"engines": {
"node": ">=22.13.0"
},
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
Expand Down
Loading