From b20d142f1338521ad337aeb7cc9d0f4e5b40cc8b Mon Sep 17 00:00:00 2001 From: inomdzhon Date: Tue, 25 Nov 2025 16:16:38 +0300 Subject: [PATCH] ci(publish): try to fix npm publish error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit После #466 публикация падает с ошибкой: ``` npm error code E404 npm error 404 Not Found - PUT https://registry.npmjs.org/swc-plugin-css-modules - Not found npm error 404 npm error 404 'swc-plugin-css-modules@7.1.0' is not in this registry. ``` В https://github.com/npm/cli/issues/8730#issuecomment-3572003280 указано, что возможно причина в версии NodeJS да и `@actions/setup-node@v6` требует NodeJS >= 24. Поэтому создал файл `.nvmrc` с нужной версией и заменил параметр `node-version` на `node-version-file` у `@actions/setup-node`. В будущем можно будет править версию через этот файл, а не через изменение воркфлоу. Поправил по ходу дела: - `@actions/setup-node` рекомендует использовать `contents: read` - в `package.json` поправил `repository.url`, чтобы поправить предупреждение ` npm auto-corrected some errors in your package.json when publishing`; - удалил `provenance` из `package.json`, т.к. больше не нужен, также оно автоматически включено при использовании [Trusted Publishing](https://docs.npmjs.com/trusted-publishers#automatic-provenance-generation). --- .github/workflows/publish.yml | 8 +++++--- .nvmrc | 1 + package.json | 7 ++----- 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 .nvmrc diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8240586..8e8b7fb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -22,7 +22,8 @@ jobs: publish: runs-on: ubuntu-latest permissions: - id-token: write + contents: read # Recommended for actions/setup-node + id-token: write # Required for OIDC steps: - uses: actions/checkout@v6 with: @@ -30,7 +31,7 @@ jobs: - uses: actions/setup-node@v6 with: - node-version: 20 + node-version-file: ".nvmrc" cache: "npm" always-auth: true registry-url: "https://registry.npmjs.org" @@ -40,6 +41,7 @@ jobs: rustup target add wasm32-wasip1 - run: npm run test + - run: npm run build - name: Set Git credentials @@ -63,4 +65,4 @@ jobs: tags: true - name: Publishing release - run: npm publish --non-interactive + run: npm publish diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..6ac2314 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v24.11.1 \ No newline at end of file diff --git a/package.json b/package.json index 09d76e2..dc712bc 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "homepage": "https://github.com/VKCOM/swc-plugin-css-modules", "repository": { "type": "git", - "url": "https://github.com/VKCOM/swc-plugin-css-modules.git" + "url": "git+https://github.com/VKCOM/swc-plugin-css-modules.git" }, "bugs": "https://github.com/VKCOM/swc-plugin-css-modules/issues", "main": "swc_plugin_css_modules.wasm", @@ -27,8 +27,5 @@ "swc_plugin_css_modules.wasm", "bindings/types.d.ts" ], - "preferUnplugged": true, - "publishConfig": { - "provenance": true - } + "preferUnplugged": true }