mirror of
https://github.com/zed-industries/zed.git
synced 2026-05-24 13:39:08 +00:00
Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Closes #ISSUE Release Notes: - N/A or Added/Fixed/Improved ...
157 lines
5.5 KiB
YAML
157 lines
5.5 KiB
YAML
# Generated from xtask::workflows::deploy_docs
|
|
# Rebuild with `cargo xtask workflows`.
|
|
name: deploy_docs
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
channel:
|
|
description: channel
|
|
type: string
|
|
default: ''
|
|
checkout_ref:
|
|
description: checkout_ref
|
|
type: string
|
|
default: ''
|
|
secrets:
|
|
DOCS_AMPLITUDE_API_KEY:
|
|
description: DOCS_AMPLITUDE_API_KEY
|
|
required: true
|
|
DOCS_CONSENT_IO_INSTANCE:
|
|
description: DOCS_CONSENT_IO_INSTANCE
|
|
required: true
|
|
CLOUDFLARE_API_TOKEN:
|
|
description: CLOUDFLARE_API_TOKEN
|
|
required: true
|
|
CLOUDFLARE_ACCOUNT_ID:
|
|
description: CLOUDFLARE_ACCOUNT_ID
|
|
required: true
|
|
workflow_dispatch:
|
|
inputs:
|
|
channel:
|
|
description: 'Docs channel to deploy: nightly, preview, or stable'
|
|
type: string
|
|
default: ''
|
|
checkout_ref:
|
|
description: Git ref to checkout and deploy. Defaults to event SHA when omitted.
|
|
type: string
|
|
default: ''
|
|
jobs:
|
|
deploy_docs:
|
|
if: github.repository_owner == 'zed-industries'
|
|
name: Build and Deploy Docs
|
|
runs-on: namespace-profile-16x32-ubuntu-2204
|
|
env:
|
|
DOCS_AMPLITUDE_API_KEY: ${{ secrets.DOCS_AMPLITUDE_API_KEY }}
|
|
DOCS_CONSENT_IO_INSTANCE: ${{ secrets.DOCS_CONSENT_IO_INSTANCE }}
|
|
CC: clang
|
|
CXX: clang++
|
|
steps:
|
|
- id: resolve-channel
|
|
name: deploy_docs::resolve_channel_step
|
|
run: |
|
|
if [ -z "$CHANNEL" ]; then
|
|
if [ "$GITHUB_REF" = "refs/heads/main" ]; then
|
|
CHANNEL="nightly"
|
|
else
|
|
echo "::error::channel input is required when ref is not main."
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
case "$CHANNEL" in
|
|
"nightly")
|
|
SITE_URL="/docs/nightly/"
|
|
PROJECT_NAME="docs-nightly"
|
|
;;
|
|
"preview")
|
|
SITE_URL="/docs/preview/"
|
|
PROJECT_NAME="docs-preview"
|
|
;;
|
|
"stable")
|
|
SITE_URL="/docs/"
|
|
PROJECT_NAME="docs"
|
|
;;
|
|
*)
|
|
echo "::error::Invalid docs channel '$CHANNEL'. Expected one of: nightly, preview, stable."
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
{
|
|
echo "channel=$CHANNEL"
|
|
echo "site_url=$SITE_URL"
|
|
echo "project_name=$PROJECT_NAME"
|
|
} >> "$GITHUB_OUTPUT"
|
|
env:
|
|
CHANNEL: ${{ inputs.channel }}
|
|
- name: steps::checkout_repo
|
|
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
|
|
with:
|
|
clean: false
|
|
ref: ${{ inputs.checkout_ref != '' && inputs.checkout_ref || github.sha }}
|
|
- name: steps::setup_cargo_config
|
|
run: |
|
|
mkdir -p ./../.cargo
|
|
cp ./.cargo/ci-config.toml ./../.cargo/config.toml
|
|
- name: steps::cache_rust_dependencies_namespace
|
|
uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9
|
|
with:
|
|
cache: rust
|
|
path: ~/.rustup
|
|
- name: steps::setup_linux
|
|
run: ./script/linux
|
|
- name: steps::download_wasi_sdk
|
|
run: ./script/download-wasi-sdk
|
|
- name: ./script/generate-action-metadata
|
|
run: ./script/generate-action-metadata
|
|
- name: deploy_docs::lychee_link_check
|
|
uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
|
|
with:
|
|
args: --no-progress --exclude '^http' './docs/src/**/*'
|
|
fail: true
|
|
jobSummary: false
|
|
- name: deploy_docs::install_mdbook
|
|
uses: peaceiris/actions-mdbook@ee69d230fe19748b7abf22df32acaa93833fad08
|
|
with:
|
|
mdbook-version: 0.4.37
|
|
- name: deploy_docs::build_docs_book
|
|
run: |
|
|
mkdir -p target/deploy
|
|
mdbook build ./docs --dest-dir=../target/deploy/docs/
|
|
env:
|
|
DOCS_CHANNEL: ${{ steps.resolve-channel.outputs.channel }}
|
|
MDBOOK_BOOK__SITE_URL: ${{ steps.resolve-channel.outputs.site_url }}
|
|
- name: deploy_docs::lychee_link_check
|
|
uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332
|
|
with:
|
|
args: --no-progress --exclude '^http' 'target/deploy/docs'
|
|
fail: true
|
|
jobSummary: false
|
|
- name: deploy_docs::docs_deploy_steps::deploy_to_cf_pages
|
|
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: pages deploy target/deploy --project-name=${{ steps.resolve-channel.outputs.project_name }} --branch main
|
|
- name: deploy_docs::docs_deploy_steps::upload_install_script
|
|
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: r2 object put -f script/install.sh zed-open-source-website-assets/install.sh
|
|
- name: deploy_docs::docs_deploy_steps::deploy_docs_worker
|
|
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: deploy .cloudflare/docs-proxy/src/worker.js
|
|
- name: deploy_docs::docs_deploy_steps::upload_wrangler_logs
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
with:
|
|
name: wrangler_logs
|
|
path: /home/runner/.config/.wrangler/logs/
|
|
timeout-minutes: 60
|
|
defaults:
|
|
run:
|
|
shell: bash -euxo pipefail {0}
|