Skip to content

Commit

Permalink
fix: node auth token
Browse files Browse the repository at this point in the history
  • Loading branch information
edmolima committed Nov 19, 2024
1 parent adde444 commit d06df91
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,44 @@ name: Publish Package
on:
push:
tags:
- v*
- v* # Triggers on version tags like "v1.0.0"

jobs:
publish-npm:
permissions:
id-token: write
contents: 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

- name: Install npm
uses: actions/setup-node@v3
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: npm # Cache dependencies for faster builds

- run: npm install
# Step 3: Install dependencies
- name: Install Dependencies
run: npm install

- run: npx changelogithub --no-group
continue-on-error: true
# 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}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: npm publish --access public
# Step 5: Authenticate with NPM and Publish
- name: Publish to NPM
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NPM_CONFIG_PROVENANCE: true
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit d06df91

Please sign in to comment.