Test #50
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
| name: Publish Any Commit | |
| on: [push, pull_request] | |
| env: | |
| NPM_TOKEN: "some-token" | |
| jobs: | |
| check: | |
| # First, trigger a permissions check on the user approving the pull request. | |
| # if: github.event.review.state == 'approved' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| has-permissions: ${{ steps.checkPermissions.outputs.require-result }} | |
| steps: | |
| - name: Check permissions | |
| id: checkPermissions | |
| uses: actions-cool/check-user-permission@v2 | |
| with: | |
| # In this example, the approver must have the write access | |
| # to the repository to trigger the package preview. | |
| require: "write" | |
| publish: | |
| needs: check | |
| # Publish the preview package only if the permissions check passed. | |
| if: needs.check.outputs.has-permissions == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - run: corepack enable | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm build | |
| - name: Test | |
| run: pnpm test | |
| - name: Publish | |
| run: pnpm dlx pkg-pr-new publish |