Repository navigation
159 lines (157 loc) · 5.55 KB
/
Copy pathdeploy_docs.yml
File metadata and controls
159 lines (157 loc) · 5.55 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
# 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: ''
permissions:
contents: read
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}