Repository navigation
134 lines (115 loc) · 5.07 KB
/
Copy pathrelease-website.yml
File metadata and controls
134 lines (115 loc) · 5.07 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
name: Release Website
on:
push:
branches:
- website-versioned-docs
- fix/website-versioned-build
workflow_run:
workflows: ["Release Crate"]
types:
- completed
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
# Pages accepts one deployment at a time; queue rather than cancel so a release
# deploy is never dropped in favour of a manually dispatched one.
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' || github.event_name == 'push' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# `workflow_run` reports the commit that triggered the release; the
# other events carry no such sha and check out their own ref.
ref: ${{ github.event.workflow_run.head_sha || github.ref }}
- name: Checkout latest approved showcases
uses: actions/checkout@v4
with:
repository: longbridge/gpui-kit-showcases
ref: main
path: .showcases
persist-credentials: false
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.4.0
- name: Install Showcase validation and rendering dependencies
working-directory: .showcases
run: bun install --frozen-lockfile
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Setup nightly Rust for GPUI Base WASM
run: |
rustup toolchain install nightly --profile minimal
rustup target add wasm32-unknown-unknown --toolchain nightly
- name: Install wasm-bindgen-cli
# Keep the CLI version in sync with the `wasm-bindgen` crate in Cargo.lock
run: |
version=$(grep -A 1 '^name = "wasm-bindgen"$' Cargo.lock | grep '^version' | cut -d '"' -f 2)
cargo install -f wasm-bindgen-cli --version "$version"
- name: Cache Cargo dependencies
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-wasm-${{ hashFiles('**/Cargo.lock') }}
- name: Build Story Web (WASM)
working-directory: crates/story-web
run: |
make build-prod
- name: Build GPUI Base examples (WASM)
working-directory: crates/base/examples/wasm
run: |
make build
- name: Build Website
working-directory: website
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHOWCASES_DIR: ${{ github.workspace }}/.showcases
run: |
bun install
bun run test:showcases
- name: Restore historical website builds
uses: actions/cache/restore@v6
with:
path: website/.version-cache
key: website-versions-${{ hashFiles('website/astro.config.mjs', 'website/package.json', 'website/public/**', 'website/src/components/**', 'website/src/layouts/**', 'website/src/lib/**', 'website/src/pages/**', 'website/src/styles/**', 'themes/**', 'script/build-website-versions', 'script/snapshot-website', 'script/normalize-website-frontmatter.mjs') }}-${{ github.run_id }}
restore-keys: |
website-versions-
- name: Build versioned Website
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SHOWCASES_DIR: ${{ github.workspace }}/.showcases
WEBSITE_VERSION_CACHE_DIR: ${{ github.workspace }}/website/.version-cache
WEBSITE_VERSION_BUILD_FINGERPRINT: ${{ hashFiles('website/astro.config.mjs', 'website/package.json', 'website/public/**', 'website/src/components/**', 'website/src/layouts/**', 'website/src/lib/**', 'website/src/pages/**', 'website/src/styles/**', 'themes/**', 'script/build-website-versions', 'script/snapshot-website', 'script/normalize-website-frontmatter.mjs') }}
run: script/build-website-versions
- name: Save historical website builds
uses: actions/cache/save@v6
with:
path: website/.version-cache
key: website-versions-${{ hashFiles('website/astro.config.mjs', 'website/package.json', 'website/public/**', 'website/src/components/**', 'website/src/layouts/**', 'website/src/lib/**', 'website/src/pages/**', 'website/src/styles/**', 'themes/**', 'script/build-website-versions', 'script/snapshot-website', 'script/normalize-website-frontmatter.mjs') }}-${{ github.run_id }}
- name: Copy WASM apps to Website
run: |
mkdir -p website/dist/gallery
cp -r crates/story-web/www/dist/* website/dist/gallery/
mkdir -p website/dist/examples/base
cp -r crates/base/examples/wasm/www/dist/* website/dist/examples/base/
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "website/dist"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4