From 78dbab4c2e07504197a1df0ddc590e95dcd2eea9 Mon Sep 17 00:00:00 2001 From: Moritz Vetter <16950410+Isokaeder@users.noreply.github.com> Date: Tue, 14 May 2024 11:34:07 +0200 Subject: [PATCH] fix(ci): use `yarn publish` in publish workflow Co-Authored-By: Florian Wendelborn <1133858+FlorianWendelborn@users.noreply.github.com> --- .github/workflows/publish.yml | 10 +++++++--- internals/scripts/source/npmrc-template | 3 +++ knip.json | 2 +- package.json | 5 ++++- packages/eslint-config/package.json | 7 +++++-- packages/kotti-ui/package.json | 2 +- packages/vue-use-tippy/package.json | 2 +- packages/yoco/package.json | 7 +++++-- 8 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 internals/scripts/source/npmrc-template diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 976fc4b0f5..86fc2a1efe 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,12 +28,16 @@ jobs: - name: Install modules run: yarn install --frozen-lockfile - # update npm for provenance support - - run: npm --version && npm install -g npm && npm --version - # make extra sure this publish wouldn’t break anything - run: yarn run build check test + # HACK: When putting this workflow into action, the pipeline did not find the + # correct registry and/or Auth Token. To fix this we did the following: + # - adding both of these lines (we are not sure if only one would have done the trick) + # - using `yarn publish` instead of `npm publish` + - run: cp internals/scripts/source/npmrc-template /home/runner/work/_temp/.npmrc + - run: cp internals/scripts/source/npmrc-template .npmrc + - name: publish run: bun internals/scripts/source/publish.ts env: diff --git a/internals/scripts/source/npmrc-template b/internals/scripts/source/npmrc-template new file mode 100644 index 0000000000..ababd7a28e --- /dev/null +++ b/internals/scripts/source/npmrc-template @@ -0,0 +1,3 @@ +//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN} +registry=https://registry.npmjs.org/ +always-auth=true diff --git a/knip.json b/knip.json index 6d8b8a2630..72f07c4288 100644 --- a/knip.json +++ b/knip.json @@ -1,7 +1,7 @@ { "$schema": "https://unpkg.com/knip@5/schema.json", "ignore": ["**/dist/**"], - "ignoreBinaries": ["dot", "open"], + "ignoreBinaries": ["dot", "open", "publish"], "ignoreDependencies": ["lerna", "lint-staged"], "workspaces": { "packages/*": { diff --git a/package.json b/package.json index bbf59f44ee..73afb6cacd 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,10 @@ "useTabs": true }, "private": true, - "repository": "git@github.com:3YOURMIND/kotti", + "repository": { + "type": "git", + "url": "git+https://github.com/3YOURMIND/kotti.git" + }, "scripts": { "build": "turbo run build", "check": "turbo run check", diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 89cfbba654..f70568d2f5 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -46,7 +46,10 @@ "peerDependencies": { "eslint": ">= 9" }, - "repository": "git+https://github.com/3YOURMIND/kotti.git", + "repository": { + "type": "git", + "url": "git+https://github.com/3YOURMIND/kotti.git" + }, "scripts": { "build": "./scripts/build.sh", "check:eslint": "eslint --max-warnings=0 .", @@ -54,7 +57,7 @@ "check:publint": "publint", "fix:eslint": "yarn run check:eslint --fix", "fix:prettier": "yarn run check:prettier --write", - "publish-package": "npm publish --access public --provenance" + "publish-package": "yarn publish --no-git-tag-version --verbose --non-interactive --access public" }, "type": "module", "types": "./dist/mjs/index.d.ts", diff --git a/packages/kotti-ui/package.json b/packages/kotti-ui/package.json index 57654d871f..4e0b724412 100644 --- a/packages/kotti-ui/package.json +++ b/packages/kotti-ui/package.json @@ -85,7 +85,7 @@ "fix:eslint": "yarn run check:eslint --fix", "fix:prettier": "yarn run check:prettier --write", "fix:stylelint": "yarn run check:stylelint --fix", - "publish-package": "npm publish --access public --provenance", + "publish-package": "yarn publish --no-git-tag-version --verbose --non-interactive --access public", "test": "vitest --run --typecheck", "watch": "vite build --watch" }, diff --git a/packages/vue-use-tippy/package.json b/packages/vue-use-tippy/package.json index 63bf6c4da4..57faddd181 100644 --- a/packages/vue-use-tippy/package.json +++ b/packages/vue-use-tippy/package.json @@ -56,7 +56,7 @@ "check:publint": "publint", "fix:eslint": "yarn run check:eslint --fix", "fix:prettier": "yarn run check:prettier --write", - "publish-package": "npm publish --access public --provenance" + "publish-package": "yarn publish --no-git-tag-version --verbose --non-interactive --access public" }, "type": "module", "types": "./dist/mjs/index.d.ts", diff --git a/packages/yoco/package.json b/packages/yoco/package.json index a9e37f7fba..e661f83731 100644 --- a/packages/yoco/package.json +++ b/packages/yoco/package.json @@ -51,7 +51,10 @@ "main": "./dist/cjs/index.cjs", "module": "./dist/mjs/index.js", "name": "@3yourmind/yoco", - "repository": "git+https://github.com/3YOURMIND/kotti.git", + "repository": { + "type": "git", + "url": "git+https://github.com/3YOURMIND/kotti.git" + }, "scripts": { "build": "./scripts/build.sh", "check:eslint": "eslint --max-warnings=0 .", @@ -60,7 +63,7 @@ "check:stylelint": "stylelint style.css", "fix:eslint": "yarn run check:eslint --fix", "fix:prettier": "yarn run check:prettier --write", - "publish-package": "npm publish --access public --provenance" + "publish-package": "yarn publish --no-git-tag-version --verbose --non-interactive --access public" }, "style": "./style.css", "type": "module",