Files
discordeno/.github/workflows/site.yml
Fleny 011f0fe0dc ci: Use turbo remote cache (#4666)
* Use a turbo remote cache server for CI

`rharkor/caching-for-turbo` uses github actions cache to provide a remote cache server for turbo, so we can use previuously created cache if available and requested by turbo, and this doesn't have the downside of having the cache growing indefinitely like with normal github actions cache as since the single caches are uploaded to the github actions cache, github can evict the old cache when it's not used or there is no space left.

Also add turbo to website so we can cache the build

* Use turbo for website build & build:doc

* fix typo, tubo -> turbo

---------

Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
2026-01-07 13:40:27 -06:00

99 lines
2.8 KiB
YAML

name: Deploy Docs Site
permissions:
contents: read
on:
push:
branches: ['main']
pull_request:
workflow_dispatch:
jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20
cache: yarn
cache-dependency-path: |
yarn.lock
website/yarn.lock
- name: yarn install (root)
run: yarn install --immutable
- name: Cache for Turbo
uses: rharkor/caching-for-turbo@v2.3.5
with:
cache-prefix: turbo-cache-
- name: Cache for Turbo
uses: rharkor/caching-for-turbo@v2.3.5
with:
cache-prefix: turbo-cache-website-
server-port: 41231 # The default is 41230, but we use a different cache key so we need a different port
- name: Build all pkg
run: yarn release-build
- name: Build docs
run: yarn turbo build:doc --single-package
- run: yarn install --immutable
working-directory: ./website
- name: Restore bundler cache
uses: actions/cache@v5
with:
key: ${{ runner.os }}-docusaurus-bundler-${{ github.sha }}
path: ./website/node_modules/.cache
restore-keys: |
${{ runner.os }}-docusaurus-bundler-
- name: Build website
run: yarn turbo build
working-directory: ./website
env:
TURBO_API: http://localhost:41231
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./website/build
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 20
cache: yarn
cache-dependency-path: |
yarn.lock
website/yarn.lock
- name: yarn install (root)
run: yarn install --immutable
- name: Cache for Turbo
uses: rharkor/caching-for-turbo@v2.3.5
with:
cache-prefix: turbo-cache-
- name: Build all pkg
run: yarn release-build
- name: Build docs
run: yarn turbo build:doc --single-package
- run: yarn install --immutable
working-directory: ./website
- run: yarn typecheck
working-directory: ./website
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
concurrency: deploy-site
permissions:
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4