From 993a19bf16f385478a0ef1f88a9d4a7a77b6a750 Mon Sep 17 00:00:00 2001 From: Inomdzhon Mirdzhamolov Date: Wed, 21 Jun 2023 10:44:58 +0300 Subject: [PATCH] fix(ci): setup yarnrc for publish with correct way `yarn >= 2` ignore `.npmrc` and that is why we: - set `npmRegistryServer` (default is "https://registry.yarnpkg.com") see https://yarnpkg.com/configuration/yarnrc#npmRegistryServer - set `npmAlwaysAuth` --- .github/actions/publish-workflow-1-setup/action.yml | 2 -- .github/actions/publish-workflow-4-complete/action.yml | 7 ++++--- .prettierignore | 2 ++ .yarnrc.yml | 6 +++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/actions/publish-workflow-1-setup/action.yml b/.github/actions/publish-workflow-1-setup/action.yml index eb62347..b1c9e95 100644 --- a/.github/actions/publish-workflow-1-setup/action.yml +++ b/.github/actions/publish-workflow-1-setup/action.yml @@ -9,8 +9,6 @@ runs: with: node-version: 18 cache: 'yarn' - always-auth: true - registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: YARN_ENABLE_SCRIPTS=false yarn install diff --git a/.github/actions/publish-workflow-4-complete/action.yml b/.github/actions/publish-workflow-4-complete/action.yml index c77d8ae..88d0942 100644 --- a/.github/actions/publish-workflow-4-complete/action.yml +++ b/.github/actions/publish-workflow-4-complete/action.yml @@ -46,11 +46,12 @@ runs: github_token: ${{ inputs.token }} branch: ${{ inputs.branch }} - - name: Prepare NPM credentials + - name: Setup NPM Auth Token to .yarnrc.yml run: | - echo npmAuthToken: "$NODE_AUTH_TOKEN" >> ./.yarnrc.yml + yarn config set npmAlwaysAuth true + yarn config set npmAuthToken $NPM_AUTH_TOKEN env: - NODE_AUTH_TOKEN: ${{ inputs.npm_token }} + NPM_AUTH_TOKEN: ${{ inputs.npm_token }} shell: bash - name: Publish release of ${{ inputs.package_name }} diff --git a/.prettierignore b/.prettierignore index 07862f2..606a595 100644 --- a/.prettierignore +++ b/.prettierignore @@ -35,3 +35,5 @@ coverage # Yarn .yarn/* +## yarn itself formats the file +.yarnrc.yml diff --git a/.yarnrc.yml b/.yarnrc.yml index 4c355ef..65e6a8e 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1,7 +1,11 @@ nodeLinker: node-modules +npmPublishAccess: public + +npmRegistryServer: "https://registry.npmjs.org" + plugins: - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs - spec: '@yarnpkg/plugin-workspace-tools' + spec: "@yarnpkg/plugin-workspace-tools" yarnPath: .yarn/releases/yarn-3.6.0.cjs