-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
83 lines (71 loc) · 2.8 KB
/
preview-packages.yml
File metadata and controls
83 lines (71 loc) · 2.8 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: 📦 Preview packages (pkg.pr.new)
# Publishes installable preview builds of the public @trigger.dev/* packages
# for every push to a branch, via https://pkg.pr.new. These are NOT published
# to npm — pkg.pr.new serves them by commit SHA and drops install instructions
# in a comment on the associated PR, e.g.
# npm i https://pkg.pr.new/@trigger.dev/sdk@<sha>
#
# Prerequisites:
# - The pkg.pr.new GitHub App must be installed on triggerdotdev/trigger.dev
# (https://github.com/apps/pkg-pr-new). Publishing fails until it is.
#
# Fork note: pkg.pr.new authenticates with a GitHub Actions OIDC token, which
# GitHub does not issue to pull_request workflows from forks. This `push`
# trigger therefore covers branches pushed to this repo (the core team), not
# external fork PRs. Adding fork coverage would require a workflow_run two-stage
# setup.
on:
push:
branches-ignore:
- main
- changeset-release/main
paths:
- "package.json"
- "packages/**"
- "pnpm-lock.yaml"
- "pnpm-workspace.yaml"
- "turbo.json"
- ".github/workflows/preview-packages.yml"
- "scripts/stamp-preview-version.mjs"
- "scripts/updateVersion.ts"
concurrency:
group: preview-packages-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
id-token: write # OIDC token used by pkg.pr.new to authenticate the publish
jobs:
publish:
name: Build and publish previews
runs-on: ubuntu-latest
if: github.repository == 'triggerdotdev/trigger.dev'
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: false
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
with:
version: 10.33.2
- name: ⎔ Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 20.20.0
cache: "pnpm"
- name: 📥 Install dependencies
run: pnpm install --frozen-lockfile
- name: 📀 Generate Prisma client
run: pnpm run generate
# Stamp a unique 0.0.0-preview-<sha> version before building so it can't
# collide with real npm versions and so updateVersion.ts bakes it into the
# runtime VERSION constant. See scripts/stamp-preview-version.mjs.
- name: 🏷️ Stamp preview version
run: node scripts/stamp-preview-version.mjs
env:
GITHUB_SHA: ${{ github.sha }}
- name: 🔨 Build packages
run: pnpm run build --filter "@trigger.dev/*" --filter "trigger.dev"
- name: 🚀 Publish previews to pkg.pr.new
run: pnpm exec pkg-pr-new publish --pnpm --compact --commentWithSha './packages/*'