Repository navigation
136 lines (120 loc) · 4.26 KB
/
Copy pathdeploy-pages.yml
File metadata and controls
136 lines (120 loc) · 4.26 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Deploy demos and handbook to Pages
# Publishes the example apps and the handbook to GitHub Pages so there is
# a link to hand people. The demos consume the packages through `file:` paths,
# so whatever is on this branch is exactly what the demos are built against.
on:
push:
branches: [develop]
# Only rebuild when something the site actually renders could have changed.
# The handbook is built from the READMEs and docs/.
paths:
- 'packages/**'
- 'example/**'
- 'handbook/**'
- 'docs/**'
- 'storybook/**'
- 'README.md'
- '.github/workflows/deploy-pages.yml'
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# One deployment at a time, and never cancel one midway.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
env:
# Project pages live under /<repo>/, so every app needs its assets
# prefixed or they 404.
SITE_BASE: /${{ github.event.repository.name }}
steps:
- uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install workspace dependencies
run: npm ci
- name: Build packages
run: npm run build
- name: Build react demo
working-directory: example/react-app
env:
PAGES_BASE_PATH: ${{ env.SITE_BASE }}/react
run: |
npm install --no-audit --no-fund
npm run build
- name: Build vue demo
working-directory: example/vue-app
env:
PAGES_BASE_PATH: ${{ env.SITE_BASE }}/vue/
run: |
npm install --no-audit --no-fund
npm run build
- name: Build svelte demo
working-directory: example/svelte-app
env:
PAGES_BASE_PATH: ${{ env.SITE_BASE }}/svelte/
run: |
npm install --no-audit --no-fund
npm run build
# `npm run build --`, not `npx ng build`: the app's `prebuild` hook
# generates src/app/demo-sources.ts, which is gitignored and so absent
# from a fresh checkout. Calling the binary directly skips the hook and
# the build fails on a missing module. npm forwards the extra args to
# `ng build`.
- name: Build angular demo
working-directory: example/angular-app
run: |
npm install --no-audit --no-fund
npm run build -- --base-href ${{ env.SITE_BASE }}/angular/
# The handbook's pages are generated from the READMEs and docs/ by
# handbook/scripts/sync.mjs, which `npm run build` runs first.
- name: Build handbook
working-directory: handbook
env:
PAGES_BASE_PATH: ${{ env.SITE_BASE }}/handbook/
run: |
npm install --no-audit --no-fund
npm run build
# Reads the packages from source (storybook/vite.shared.ts), so it does
# not need the build above; it has its own lockfile and install.
- name: Build Storybook
working-directory: storybook
run: |
npm ci --no-audit --no-fund
npm run build-storybook
- name: Assemble the site
run: |
mkdir -p _site
cp example/pages-index.html _site/index.html
cp -r handbook/.vitepress/dist _site/handbook
cp -r storybook/storybook-static _site/storybook
cp -r example/react-app/out _site/react
cp -r example/vue-app/dist _site/vue
cp -r example/svelte-app/dist _site/svelte
cp -r example/angular-app/dist/example-angular-app _site/angular
# Pages runs the output through Jekyll otherwise, which drops
# directories starting with an underscore - _next among them.
touch _site/.nojekyll
echo "--- deployed tree ---"
find _site -maxdepth 2 -name index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: _site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5