fix: npmrc occured errors in ci #12
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: Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*.*.*" # Triggers on tags like v1.2.3 | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Explicitly set the permission to write contents | |
steps: | |
# 1. Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# 2. Set up Node.js with authentication | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" # Specify your Node.js version | |
registry-url: "https://registry.npmjs.org/" | |
# Use the NPM_TOKEN secret for authentication | |
node-auth-token: ${{ secrets.NPM_TOKEN }} | |
# If your package is scoped (e.g., @your-scope/package), uncomment the following line and set your scope | |
# scope: '@your-scope' | |
# Debug npm configuration | |
- name: Print npm configuration | |
run: npm config list | |
# 3. Install project dependencies | |
- name: Install dependencies | |
run: npm install | |
# 4. Run release-it to handle the release process | |
- name: Run release-it | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Default GitHub token | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm run release | |
# 5. Update CHANGELOG.md and push changes | |
- name: Update CHANGELOG.md | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add CHANGELOG.md | |
git commit -m 'Update CHANGELOG.md' | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |