From 47745803c94c77b25194c97d8939984cf2bcb215 Mon Sep 17 00:00:00 2001 From: Mira Date: Wed, 9 Sep 2026 18:43:09 +0300 Subject: [PATCH] Problem: no way to publish the package Solution: - Add workflow to do the job by pushing a version tag. - pin the pnpm version via package.json - Now, but likely temporary it is using token... but only as I can't login from PC and package never had published yet! --- .github/workflows/publish-to-npm.yaml | 38 +++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-to-npm.yaml diff --git a/.github/workflows/publish-to-npm.yaml b/.github/workflows/publish-to-npm.yaml new file mode 100644 index 0000000..8661a2b --- /dev/null +++ b/.github/workflows/publish-to-npm.yaml @@ -0,0 +1,38 @@ +name: Publish to NPM + +on: + push: + tags: + - 'v*' + +jobs: + publish: + if: github.repository == 'ArsenijSerjogin/tailwind-dashed-border' + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: '24.14.0' + registry-url: 'https://registry.npmjs.org' + package-manager-cache: false + - name: Verify version matches tag + run: | + VERSION="${GITHUB_REF_NAME#v}" + FILE_VERSION=$(node -p "require('./package.json').version") + if [ "$VERSION" != "$FILE_VERSION" ]; then + echo "Version mismatch: tag=$VERSION, package.json=$FILE_VERSION" + exit 1 + fi + - run: pnpm install --frozen-lockfile + - run: pnpm run check + - run: pnpm run build + - name: Publish to NPM + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: pnpm publish --access public --provenance \ No newline at end of file diff --git a/package.json b/package.json index 9789a1d..b7d6566 100644 --- a/package.json +++ b/package.json @@ -46,5 +46,6 @@ "bugs": { "url": "https://github.com/ArsenijSerjogin/tailwind-dashed-border/issues" }, - "homepage": "https://github.com/ArsenijSerjogin/tailwind-dashed-border" + "homepage": "https://github.com/ArsenijSerjogin/tailwind-dashed-border", + "packageManager": "pnpm@11.3.0+sha512.2c403d6594527287672b1f7056343a1f7c3634036a67ffabfcc2b3d7595d843768f8787148d1b57cf7956c90606bbd192857c363af19e96d2d0ec9ec5741d215" }