test: Move e2e tests into shared library #437
This file contains 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: PR Preview | |
on: | |
pull_request: | |
types: [opened, synchronize, labeled] | |
pull_request_review: | |
types: [submitted] | |
jobs: | |
check-changes: | |
name: Check for relevant changes to deploy | |
if: | | |
github.event.review.state == 'APPROVED' || | |
contains(github.event.pull_request.author_association, 'MEMBER') || | |
contains(github.event.pull_request.labels.*.name, 'deploy:preview') | |
runs-on: ubuntu-24.04 | |
outputs: | |
enable: ${{ steps.check-for-changes.outputs.enable }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
fetch-depth: 2 | |
- name: Check for relevant changes | |
id: check-for-changes | |
run: | | |
if git diff --quiet HEAD^ HEAD ./packages/nuqs; then | |
echo "No changes to nuqs package, skipping preview deployment." | |
echo "enable=false" >> $GITHUB_OUTPUT | |
else | |
echo "enable=true" >> $GITHUB_OUTPUT | |
fi | |
deploy-preview: | |
name: Deploy to pkg.pr.new | |
needs: check-changes | |
if: needs.check-changes.outputs.enable == 'true' | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af | |
with: | |
node-version-file: .node-version | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build package | |
run: pnpm build --filter nuqs | |
- name: Set package version | |
run: | | |
pnpm pkg set version=0.0.0-preview.${{ github.event.pull_request.head.sha }} | |
echo "::notice title=Install (PR)::pnpm add https://pkg.pr.new/nuqs@${{ github.event.pull_request.number }}" | |
echo "::notice title=Install (SHA)::pnpm add https://pkg.pr.new/nuqs@${{ github.event.pull_request.head.sha }}" | |
echo "::notice title=Version::0.0.0-preview.${{ github.event.pull_request.head.sha }}" | |
working-directory: packages/nuqs | |
- name: Publish to pkg.pr.new | |
run: pnpx pkg-pr-new publish --compact './packages/nuqs' |