fix: align pnpm setup with packageManager #21
Workflow file for this run
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
| # This workflow runs tests and builds, then publishes to npm on version tags. | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
| name: Node.js Package | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter use-shopping-cart run test | |
| - run: pnpm --filter use-shopping-cart run test:types | |
| build: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter use-shopping-cart run build | |
| publish-npm: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| registry-url: https://registry.npmjs.org/ | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - name: Publish to npm | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| pnpm --filter use-shopping-cart publish --dry-run | |
| else | |
| pnpm --filter use-shopping-cart publish | |
| fi | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} | |
| # publish-gpr: | |
| # needs: build | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v2 | |
| # - uses: actions/setup-node@v1 | |
| # with: | |
| # node-version: 12 | |
| # registry-url: https://npm.pkg.github.com/ | |
| # - run: yarn install && npm publish | |
| # env: | |
| # NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |