update npmrc #16
This file contains hidden or 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 to npm | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| version-and-publish: | |
| 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: "20.x" | |
| registry-url: "https://registry.npmjs.org/" | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Bump version (patch) | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| yarn version --patch --no-git-tag-version | |
| git add package.json | |
| git commit -m "ci: bump version [skip ci]" | |
| - name: Configure npm for publishing | |
| run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Who am I | |
| run: npm whoami || echo "whoami failed" | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Check if .npmrc exists | |
| run: test -f .npmrc && echo ".npmrc exists" | |
| - name: Publish to npm | |
| run: npm publish --access public || true | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Push version commit | |
| run: git push |