-
-
Notifications
You must be signed in to change notification settings - Fork 46
172 lines (136 loc) · 5.93 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
172 lines (136 loc) · 5.93 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
name: Deploy docs
on:
push:
branches:
- main
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: read
concurrency:
group: pages-${{ github.ref }}
cancel-in-progress: true
jobs:
build-docs:
runs-on: blacksmith-32vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- name: Setup Wild linker
uses: wild-linker/action@0bbbfa5df4380cab8e63cb8505a1ce65e1d10203 # v0.9.0
with:
wild-version: "0.9.0"
- uses: ./.github/actions/setup-rust-sticky-cache
with:
key: docs-napi
cache-key-suffix: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Cargo.lock') }}
- name: Setup Vite+ and Node.js
uses: voidzero-dev/setup-vp@ca1c46663915d6c1042ae23bd39ab85718bfb0fa # v1
with:
node-version-file: ".node-version"
cache: true
run-install: false
- uses: ./.github/actions/setup-moonbit
- name: Install JS dependencies
run: moon run --target native tools/moon/cmd/github/vp_install -- --filter './docs...' --filter './npm/builder/vite...' --filter './npm/cli...' --filter './npm/native...'
- name: Build @vizejs/vite-plugin
run: moon run --target native tools/moon/cmd/github/run_many -- vp run --filter './npm/native' build:ci -- vp run --filter './npm/cli' build -- vp run --filter './npm/builder/vite' build
- name: Build docs
run: vp run --filter './docs' build
- name: Upload docs artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: docs
path: docs/dist
build-playground:
runs-on: blacksmith-32vcpu-ubuntu-2404
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
targets: wasm32-unknown-unknown
- name: Setup Wild linker
uses: wild-linker/action@0bbbfa5df4380cab8e63cb8505a1ce65e1d10203 # v0.9.0
with:
wild-version: "0.9.0"
- uses: ./.github/actions/setup-moonbit
- uses: ./.github/actions/setup-rust-sticky-cache
with:
key: docs-wasm
cache-key-suffix: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('Cargo.lock') }}
- name: Cache WASM build
id: cache-wasm
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
with:
path: |
npm/wasm
playground/src/wasm
key: ${{ runner.os }}-docs-wasm-${{ hashFiles('crates/**/*.rs', 'Cargo.lock', 'npm/wasm/package.json') }}
- name: Install wasm-bindgen-cli
if: steps.cache-wasm.outputs.cache-hit != 'true'
uses: taiki-e/install-action@184183c2401be73c3bf42c2e61268aa5855379c1 # v2
with:
tool: wasm-bindgen-cli@0.2.121
- name: Build WASM
if: steps.cache-wasm.outputs.cache-hit != 'true'
run: moon run --target native tools/moon/cmd/github/build_vitrine_wasm -- npm/wasm playground/src/wasm
- name: Setup Vite+ and Node.js
uses: voidzero-dev/setup-vp@ca1c46663915d6c1042ae23bd39ab85718bfb0fa # v1
with:
node-version-file: ".node-version"
cache: true
run-install: false
- name: Install JS dependencies
run: moon run --target native tools/moon/cmd/github/vp_install -- --filter './playground...' --filter './examples/vite-musea...' --filter './npm/builder/vite-musea...' --filter './npm/builder/vite...' --filter './npm/cli...' --filter './npm/native...'
- name: Build npm packages
run: moon run --target native tools/moon/cmd/github/run_many -- vp run --filter './npm/native' build:ci -- vp run --filter './npm/cli' build -- vp run --filter './npm/builder/vite' build -- vp run --filter './npm/builder/vite-musea' build
- name: Build playground
run: vp run --filter './playground' build
- name: Clean musea example Rust target
run: cargo clean --target-dir target/docs-example
- name: Build musea-examples
run: vp run --filter './examples/vite-musea' build
- name: Upload playground artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playground
path: playground/dist
- name: Upload musea-examples artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: musea-examples
path: examples/vite-musea/dist
deploy:
runs-on: blacksmith-32vcpu-ubuntu-2404
needs: [build-docs, build-playground]
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Download all artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: artifacts
- uses: ./.github/actions/setup-moonbit
- name: Create site structure
run: moon run --target native tools/moon/cmd/github/create_site_structure --
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
- name: Upload pages artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
name: github-pages-${{ github.run_attempt }}
path: site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
with:
artifact_name: github-pages-${{ github.run_attempt }}