Repository navigation
Release Process
LaTale edited this page Dec 16, 2025
·
1 revision
This repo ships pdfjs-dist-style artifacts from build/dist/. There are two CI paths plus a manual path. Default package name may be scoped (e.g., @okkkde/pdfjs-dist); npm publishes use --access public.
- Build version is taken from
PDFJS_VERSIONenv; if absent, the legacy counter (versionPrefix + commit count) is used. - Dist artifacts place the version into
build/version.jsonandbuild/dist/package.json.
-
NPM_TOKEN: npm automation token with publish rights. -
GITHUB_TOKEN: provided by GitHub for tagging/releases (already available).
- Trigger: cron (03:00 UTC) or manual
workflow_dispatch. - Flow:
- Fetch upstream tags; pick the latest upstream tag (by commit date).
- If that tag’s commit is not yet in
master, merge the tag intomaster(retains fork changes) and pushmaster. - Set
PDFJS_VERSIONto the upstream tag (strip leadingv). -
npm ci→npx gulp dist→npm publish ./build/dist --access public. - Tag
masterwith the same upstream tag and push the tag. - Create a GitHub Release for that tag.
- Safeguard: If the tag’s commit is already reachable from
master, the workflow exits without publishing.
- Trigger: push tags matching
v*; manualworkflow_dispatchalso allowed. - Guard: Skips if the actor is
github-actions[bot](to avoid double-publish aftersync_upstream). - Flow for tag pushes:
- Set
PDFJS_VERSION=${GITHUB_REF_NAME#v}. -
npm ci→npx gulp dist→npm publish ./build/dist --access public. - Create GitHub Release (uploads tar/zip artifacts).
- Set
- For manual dispatch, provide
PDFJS_VERSIONyourself (via input or env) if you want a specific version.
- Choose a version: set
PDFJS_VERSION=0.0.x(supports suffixes like-beta1). - Build and publish:
npm ci PDFJS_VERSION=0.0.x npx gulp dist npm publish ./build/dist --access public --tag next
- The dist layout contains both
.mjsand.jstwins for ESM bundles.
- Upstream repo has no root
versionfield; tags define official versions. We mirror upstream tags and reuse them asPDFJS_VERSION. - If you change the package name (scoped), keep
--access publicto avoid 402 errors for private scopes. - Avoid tag storms:
auto_releaseis skipped when tags come fromsync_upstreamto prevent double publishes.
本仓库发布的 npm 包来自 build/dist/,保持与官方 pdfjs-dist 结构一致(含 .mjs 及对应的 .js 双份模块)。默认包名可用 scoped(如 @okkkde/pdfjs-dist),发布统一加 --access public。
- 构建版本号优先取环境变量
PDFJS_VERSION;若未设置,则退回旧逻辑(pdfjs.config的前缀 + 自基准提交的计数)。 - 构建时将版本写入
build/version.json和build/dist/package.json。
-
NPM_TOKEN:npm 自动化 token,具备发布权限。 -
GITHUB_TOKEN:GitHub 自带,用于推 tag / 建 Release。
- 触发:每日 03:00 UTC 定时或手动
workflow_dispatch。 - 步骤:
- 拉取 upstream tag,取最新 tag(按提交时间)。
- 若该 tag 对应提交尚未包含在
master,则合并该 tag 到master(保留 fork 改动),并推送master。 - 设定
PDFJS_VERSION= 上游 tag(去掉前缀v)。 -
npm ci→npx gulp dist→npm publish ./build/dist --access public。 - 给合并后的
master打同名 tag 并推送。 - 创建 GitHub Release。
- 防抖:如果 tag 已被包含在
master,则直接退出不发布。
- 触发:推送符合
v*的 tag;可手动workflow_dispatch。 - Guard:如果触发者是
github-actions[bot](来自sync_upstream的 tag),则跳过以避免重复发布。 - 流程(tag 推送):
- 设置
PDFJS_VERSION=${GITHUB_REF_NAME#v}。 -
npm ci→npx gulp dist→npm publish ./build/dist --access public。 - 创建 GitHub Release(上传 tar/zip)。
- 设置
- 手动触发时,如需特定版本,请自行设置
PDFJS_VERSION。
- 设定版本(支持
-beta1等后缀):PDFJS_VERSION=0.0.x - 构建与发布:
npm ci PDFJS_VERSION=0.0.x npx gulp dist npm publish ./build/dist --access public --tag next
- 上游根目录无
version字段;官方版本由 tag 决定,fork 会镜像该 tag 并用作PDFJS_VERSION。 - 若更换包名为 scoped,务必加
--access public,否则 npm 会返回 402。 - 已避免“重复触发”:
sync_upstream推出的 tag 不会再次触发auto_release发布。