Skip to content

feat: publish package to npm #38

feat: publish package to npm

feat: publish package to npm #38

Workflow file for this run

name: Release Package
on:
push:
branches:
- master
jobs:
release:
name: Publish to npm
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Authenticate with npm and show .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
cat ~/.npmrc | sed 's/:_authToken=.*/:_authToken=[SECURED]/'
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Configure Git
run: |
git config --global user.name "${{ secrets.GIT_USER }}"
git config --global user.email "${{ secrets.GIT_EMAIL }}"
echo "Configured Git user.name: $(git config --global user.name)"
echo "Configured Git user.email: $(git config --global user.email)"
- name: Release with release-it
run: npx --ignore-existing release-it
env:
GIT_AUTHOR_NAME: ${{ secrets.GIT_USER }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_EMAIL }}
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}