fix: publish prereleases with alpha tag #25
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: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| 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: npm install -g npm@11.5.1 | |
| - run: pnpm install --frozen-lockfile | |
| - name: Publish to npm | |
| working-directory: use-shopping-cart | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| npm publish --dry-run --tag alpha | |
| else | |
| npm publish --tag alpha | |
| fi | |
| # 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}} |