From e37b43a8e6f8b434cdbd48ea10b1e2acfe2a45fd Mon Sep 17 00:00:00 2001 From: devswithme Date: Thu, 13 Nov 2025 22:03:42 +0800 Subject: [PATCH] chore: fix ci.yml issue #6 --- .github/workflows/npm.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index c5ccf53..326ec75 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -27,6 +27,12 @@ jobs: node-version: 20 registry-url: https://registry.npmjs.org/ + - name: Configure npm authentication + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc + - name: Install dependencies run: npm ci @@ -40,15 +46,14 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc - NEW_VERSION=$(npm version patch -m "ci: release %s") - CURRENT_VERSION=$(npm view @fydemy/ui version) + NEW_VERSION=${NEW_VERSION#v} # Remove 'v' prefix + CURRENT_VERSION=$(npm view @fydemy/ui version 2>/dev/null || echo "0.0.0") if [ "$CURRENT_VERSION" = "$NEW_VERSION" ]; then - echo "Version $NEW_VERSION already exists, skipping publish" + echo "Version $NEW_VERSION already exists, skipping publish" else - npm publish + npm publish fi git push https://${GH_TOKEN}@github.com/${{ github.repository }} main --follow-tags