fix: node auth token #4
Workflow file for this run
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: Publish Package | |
on: | |
push: | |
tags: | |
- v* # Triggers on version tags like "v1.0.0" | |
jobs: | |
publish-npm: | |
permissions: | |
id-token: write | |
contents: write # Necessary for fetching code and managing tokens | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Ensure full history for changelogs or versioning | |
# Step 2: Set up Node.js | |
- name: Use Node.js v20 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
cache: npm # Cache dependencies for faster builds | |
# Step 3: Install dependencies | |
- name: Install Dependencies | |
run: npm install | |
# Step 4: Generate Changelog (Optional) | |
- name: Generate Changelog | |
run: npx changelogithub --no-group | |
continue-on-error: true # Allow workflow to continue even if this step fails | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Step 5: Authenticate with NPM and Publish | |
- name: Publish to NPM | |
run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |