generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 119
55 lines (53 loc) · 2.13 KB
/
pkg.pr.new.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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')
runs-on: ubuntu-latest
outputs:
enable: ${{ steps.check-for-changes.outputs.enable }}
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
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' || contains(github.event.pull_request.labels.*.name, 'deploy:preview')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
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'