Skip to content

Commit

Permalink
chore(website): build in ci (#1279)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Dec 15, 2024
1 parent fa687d6 commit 40d8961
Show file tree
Hide file tree
Showing 769 changed files with 102 additions and 71,425 deletions.
149 changes: 81 additions & 68 deletions .github/workflows/deploy-website.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,3 @@
name: Deploy Website
on:
push:
branches: [main]
# Allows us to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: deploy-website
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
- uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
# - name: Setup Node
# uses: actions/setup-node@v4
# with:
# node-version: 22
# cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: website/.vitepress/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

# TODO Go back to building website in CI and NOT committing the dist to the repo.
# Currently, the Twoslash results in CI are not consistent with local results.
# E.g. We'll get some variable as `any` in CI versus an actual data type in local.

# name: Deploy Website
# on:
# push:
Expand All @@ -69,27 +20,13 @@ jobs:
# with:
# fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
# - name: Setup Node
# uses: actions/setup-node@v4
# with:
# node-version: 22
# cache: pnpm
# # - name: Setup Node
# # uses: actions/setup-node@v4
# # with:
# # node-version: 22
# # cache: pnpm
# - name: Setup Pages
# uses: actions/configure-pages@v5
# # In order to build the website we need to have the library built first.
# # This is because the Twoslash will depend on the types from Graffle,
# # which in this setup is coming from a pnpm install targetting the local
# # library file path.
# - name: Install Library Dependencies
# run: pnpm install
# - name: Build Library
# run: pnpm build
# - name: Install Website Dependencies
# working-directory: website
# run: pnpm install
# - name: Build Website
# working-directory: website
# run: pnpm build
# - name: Upload artifact
# uses: actions/upload-pages-artifact@v3
# with:
Expand All @@ -105,3 +42,79 @@ jobs:
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v4

# TODO Go back to building website in CI and NOT committing the dist to the repo.
# Currently, the Twoslash results in CI are not consistent with local results.
# E.g. We'll get some variable as `any` in CI versus an actual data type in local.

name: Deploy Website
on:
push:
branches: [main]
# Allows us to run this workflow manually from the Actions tab
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: deploy-website
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
- uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Setup Pages
uses: actions/configure-pages@v5
# In order to build the website we need to have the library built first.
# This is because the Twoslash will depend on the types from Graffle,
# which in this setup is coming from a pnpm install targetting the local
# library file path.
- name: Install Library Dependencies
run: pnpm install
- name: Build Library
run: pnpm build
- name: Install Website Dependencies
working-directory: website
run: pnpm install
- name: Load Types Cache
id: load-types-cache
uses: actions/cache/restore@v4
with:
path: website/.vitepress/cache/types
key: v1-vitepress-types-cache-${{ github.run_id }}
restore-keys: |
v1-vitepress-types-cache-
- name: Build Website
working-directory: website
run: pnpm build
- name: Save Types Cache
uses: actions/cache/save@v4
with:
path: website/.vitepress/cache/types
key: ${{ steps.load-types-cache.outputs.cache-primary-key }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: website/.vitepress/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
13 changes: 13 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,22 @@ jobs:
- name: Install Website Dependencies
working-directory: website
run: pnpm install
- name: Load Types Cache
id: load-types-cache
uses: actions/cache/restore@v4
with:
path: website/.vitepress/cache/types
key: v1-vitepress-types-cache-${{ github.run_id }}
restore-keys: |
v1-vitepress-types-cache-
- name: Build Website
working-directory: website
run: pnpm build
- name: Save Types Cache
uses: actions/cache/save@v4
with:
path: website/.vitepress/cache/types
key: ${{ steps.load-types-cache.outputs.cache-primary-key }}
test-unit:
runs-on: ubuntu-latest
strategy:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ website/.vitepress/.temp
website/.vitepress/cache
legacy
project/
website/.vitepress/dist
7 changes: 6 additions & 1 deletion website/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
import { createFileSystemTypesCache } from '@shikijs/vitepress-twoslash/cache-fs'
import { ModuleKind, ModuleResolutionKind } from 'typescript'
import { defineConfig } from 'vitepress'
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
import { generateSidebar, SidebarItem, SidebarMulti } from 'vitepress-sidebar'
import { generateSidebar } from 'vitepress-sidebar'
import { SidebarItem, SidebarMulti } from 'vitepress-sidebar/types'

const prefixPattern = /\d+_/g

Expand Down Expand Up @@ -98,6 +100,9 @@ export default defineConfig({
codeTransformers: [
...(process.env.disable_twoslash ? [] : [
transformerTwoslash({
typesCache: createFileSystemTypesCache({
dir: './.vitepress/cache/types',
}),
twoslashOptions: {
handbookOptions: {
noErrors: true,
Expand Down
23 changes: 0 additions & 23 deletions website/.vitepress/dist/404.html

This file was deleted.

43 changes: 0 additions & 43 deletions website/.vitepress/dist/_assets/graffle-request.svg

This file was deleted.

Binary file not shown.
Binary file removed website/.vitepress/dist/_assets/logo-dark.png
Binary file not shown.
8 changes: 0 additions & 8 deletions website/.vitepress/dist/_assets/logo-dark.svg

This file was deleted.

Loading

0 comments on commit 40d8961

Please sign in to comment.