feat: publish package to npm #36
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Install pnpm | |
run: npm install -g pnpm | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --prefer-offline | |
- name: Authenticate with npm | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
- 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 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 }} |