Skip to content

Publish to npmjs.com #5

Publish to npmjs.com

Publish to npmjs.com #5

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Publish to npmjs.com
on:
release:
types: [created]
workflow_dispatch:
jobs:
# run-test:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - uses: pnpm/action-setup@v4
# name: Install pnpm
# with:
# version: 9
# run_install: false
# - name: Install Node.js
# uses: actions/setup-node@v4
# with:
# node-version: 22
# cache: "pnpm"
# - name: Install dependencies
# run: pnpm install
# - name: Run test
# run: pnpm test
publish-npm:
runs-on: ubuntu-latest
# needs: run-test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Set version to release tag
shell: bash
run: pnpm version from-git --no-commit-hooks --no-git-tag-version --allow-same-version
- name: Set publishing config
run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- name : pnpm publish
run: pnpm publish --access public --no-git-checks