Skip to content

fix(ci): fix GitHub Packages auth and upgrade CI to Node.js 22#28

Merged
jamliaoo merged 2 commits intomainfrom
fix/publish-auth
Apr 5, 2026
Merged

fix(ci): fix GitHub Packages auth and upgrade CI to Node.js 22#28
jamliaoo merged 2 commits intomainfrom
fix/publish-auth

Conversation

@jamliaoo
Copy link
Copy Markdown
Contributor

@jamliaoo jamliaoo commented Apr 5, 2026

背景描述 (Why)

Publish workflow 的 npm ci 步驟在安裝 @coseeing/nemeth2latex 時出現 401 Unauthorized。原因是 actions/setup-node 設定 registry-url 後會建立自己的 .npmrc(透過NPM_CONFIG_USERCONFIG 指向 /home/runner/work/_temp/.npmrc),完全覆蓋前一步手動寫入 ~/.npmrc 的 auth token。該 .npmrc 使用 NODE_AUTH_TOKEN 環境變數認證,但 npm ci 步驟沒有設定這個變數。

另外 GitHub Actions 已發出 Node.js 20 deprecation 警告,2026-06-02 起將強制使用 Node.js 24 runtime,且 Node.js 20 本身已 EOL。

實作方法 (How)

  • 移除手動寫 ~/.npmrc 的步驟(會被 setup-node 覆蓋,無效)
  • npm ci 步驟加上 NODE_AUTH_TOKEN 環境變數,讓 setup-node 產生的 .npmrc 能正確認證
  • CI workflow 也加上 registry-urlscope 設定,統一兩個 workflow 的認證方式
  • 升級 actions/checkoutactions/setup-node 從 v4 到 v5
  • Node.js runtime 從 20 升級到 22 LTS

@jamliaoo jamliaoo merged commit ac3818c into main Apr 5, 2026
1 check passed
@jamliaoo jamliaoo deleted the fix/publish-auth branch April 5, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants