ci: gate preview package publishing #215
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: package-ci | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| tags: | |
| - "!**" | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| publish_preview: | |
| description: "Publish pkg.pr.new preview packages" | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: read | |
| jobs: | |
| package-ci: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| - run: corepack enable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: pnpm --filter './packages/*' install --frozen-lockfile --ignore-scripts | |
| - name: Build package | |
| run: pnpm build | |
| - name: Debug workspace info | |
| run: | | |
| echo "Workspace packages:" | |
| pnpm list --depth=-1 --json | |
| echo "Package directories:" | |
| find packages -name "package.json" | head -10 | |
| - name: Publish preview packages | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.publish_preview }} | |
| run: pnpm dlx pkg-pr-new publish './packages/*' | |