Repository navigation
121 lines (101 loc) · 2.88 KB
/
Copy pathpull-request-preview.yml
File metadata and controls
121 lines (101 loc) · 2.88 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: PR Preview
on:
pull_request:
types: [ opened, synchronize, reopened, closed ]
paths:
- 'src/**'
- '.browserslistrc'
- 'babel.config.js'
- 'mkdocs.yml'
- 'package-lock.json'
- 'package.json'
- 'postcss.config.js'
- 'tsconfig.json'
- 'webpack.config.js'
concurrency:
group: preview-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
deployments: write
pull-requests: write
env:
NODE_VERSION: 24
jobs:
build:
name: Build PR Preview
if: github.event.action != 'closed'
runs-on: ubuntu-24.04
steps:
- name: Clone repository
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install Node.js dependencies
run: npm ci
- name: Build assets
run: npm run build
# Docoff looks up types imported by components in the bundled type declarations
- name: Copy type declarations to docs
run: cp dist/react-ui.d.ts src/docs/_assets/generated/
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Get cache ID
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: Restore cache
uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install MkDocs
run: pip install 'mkdocs-material>=9.0.0,<10.0.0'
- name: Build docs
run: mkdocs build
- name: Upload docs artifact
uses: actions/upload-artifact@v4
with:
name: docs-site
path: site/
deploy_preview:
name: Deploy PR Preview
needs: [build]
runs-on: ubuntu-24.04
environment:
name: pr-preview/pr-${{ github.event.pull_request.number }}
url: https://react-ui-org.github.io/react-ui/pr-preview/pr-${{ github.event.pull_request.number }}/
steps:
- name: Clone repository
uses: actions/checkout@v6
- name: Download docs artifact
uses: actions/download-artifact@v4
with:
name: docs-site
path: site/
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
with:
wait-for-pages-deployment: true
source-dir: site/
preview-branch: gh-pages
umbrella-dir: pr-preview
action: deploy
cleanup:
name: Clean Up PR Preview
if: github.event.action == 'closed'
runs-on: ubuntu-24.04
steps:
- name: Clone repository
uses: actions/checkout@v6
- name: Remove preview
uses: rossjrw/pr-preview-action@v1
with:
preview-branch: gh-pages
umbrella-dir: pr-preview
action: remove