-
-
Notifications
You must be signed in to change notification settings - Fork 20
92 lines (77 loc) · 2.39 KB
/
preview.yml
File metadata and controls
92 lines (77 loc) · 2.39 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
84
85
86
87
88
89
90
91
92
# https://github.com/stackblitz-labs/pkg.pr.new
name: Preview Release
on:
# push:
# branches: [main]
workflow_dispatch:
inputs:
branch:
description: 'Branch to release'
required: true
default: 'main'
permissions:
contents: read
jobs:
preview:
if: github.repository == 'web-infra-dev/rstest'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 1
ref: ${{ github.event.inputs.branch }}
- name: Install pnpm
run: |
npm install -g corepack@latest --force
corepack enable
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: changes
with:
predicate-quantifier: 'every'
filters: |
changed:
- "packages/**"
- "!packages/document/**"
- name: Setup Node.js
if: steps.changes.outputs.changed == 'true'
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
with:
node-version: 22.x
cache: 'pnpm'
- name: Install Dependencies
if: steps.changes.outputs.changed == 'true'
run: pnpm install
- name: Publish Preview
id: publish
if: steps.changes.outputs.changed == 'true'
run: pnpx pkg-pr-new publish --pnpm ./packages/*
- name: Preview summary
if: steps.changes.outputs.changed == 'true'
run: |
sha='${{ steps.publish.outputs.sha }}'
packages='${{ steps.publish.outputs.packages }}'
urls='${{ steps.publish.outputs.urls }}'
shaDisplay="${sha:-N/A}"
{
echo "## pkg.pr.new preview"
echo ""
echo "**sha**: \`$shaDisplay\`"
if [ -n "$packages" ]; then
echo ""
echo "### packages"
echo ""
for pkg in $packages; do
echo "- \`$pkg\`"
done
fi
if [ -n "$urls" ]; then
echo ""
echo "### URLs"
echo ""
for url in $urls; do
echo "- <$url>"
done
fi
} >> "$GITHUB_STEP_SUMMARY"
echo "::notice title=pkg.pr.new::sha=$shaDisplay (see Summary for packages/urls)"