Skip to content

Commit e634544

Browse files
authored
feat(ci): Integrate with pkg.pr.new (#2213)
1 parent f20a492 commit e634544

File tree

3 files changed

+339
-0
lines changed

3 files changed

+339
-0
lines changed

.github/workflows/preview-release.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Preview Release
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
- canary
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
concurrency: ${{ github.workflow }}-${{ github.ref }}
12+
jobs:
13+
release:
14+
runs-on: buildjet-4vcpu-ubuntu-2204
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
steps:
19+
- name: Checkout Repo
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 22
27+
- name: pnpm setup
28+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda
29+
- name: pnpm Cache
30+
id: pnpm-cache
31+
uses: buildjet/cache@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4
32+
with:
33+
path: |
34+
~/.pnpm-store
35+
node_modules
36+
*/*/node_modules
37+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
38+
restore-keys: |
39+
${{ runner.os }}-pnpm-
40+
- name: Install packages
41+
if: steps.pnpm-cache.outputs.cache-hit != 'true'
42+
run: pnpm install --frozen-lockfile
43+
- name: turborepo Cache
44+
uses: rharkor/caching-for-turbo@a1c4079258ae08389be75b57d4d7a70f23c1c66d
45+
with:
46+
cache-prefix: ${{ runner.os }}-turbo-
47+
provider: github
48+
- name: Run Build
49+
run: pnpm build
50+
env:
51+
SPAM_ASSASSIN_HOST: ${{ secrets.SPAM_ASSASSIN_HOST }}
52+
SPAM_ASSASSIN_PORT: ${{ secrets.SPAM_ASSASSIN_PORT }}
53+
# Add step to find changed package directories within ./packages
54+
- name: Find changed packages
55+
id: changed_packages
56+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c
57+
with:
58+
files: packages/**
59+
dir_names: true
60+
dir_names_max_depth: 2
61+
- name: Publish changed packages to pkg.pr.new
62+
if: steps.changed_packages.outputs.all_changed_and_modified_files != ''
63+
run: pnpm dlx pkg-pr-new publish ${{ steps.changed_packages.outputs.all_changed_and_modified_files }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"@types/react": "19.0.1",
2222
"@types/react-dom": "19.0.1",
2323
"happy-dom": "17.4.4",
24+
"pkg-pr-new": "0.0.43",
2425
"tsconfig": "workspace:*",
2526
"tsup": "8.4.0",
2627
"turbo": "2.5.0",

0 commit comments

Comments
 (0)