diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 000000000..bd5309f92 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,49 @@ +# https://github.com/stackblitz-labs/pkg.pr.new +name: Preview Release + +on: + pull_request: + types: [closed] + workflow_dispatch: + +permissions: + contents: read + +jobs: + preview: + if: github.repository == 'web-infra-dev/rslib' && github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Install pnpm + run: | + npm install -g corepack@latest --force + corepack enable + + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + with: + filters: | + changed: + - "packages/**" + - "pnpm-lock.yaml" + + - name: Setup Node.js + if: steps.changes.outputs.changed == 'true' + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + + - name: Install Dependencies + if: steps.changes.outputs.changed == 'true' + run: pnpm install + + - name: Publish Preview + if: steps.changes.outputs.changed == 'true' + run: pnpx pkg-pr-new publish --compact --pnpm