Clean up docs publishing flow (#11043)
* Clean up publishing flow * Update README Co-authored-by: publish-docs.sh <maintainers@solana.com>
This commit is contained in:
parent
14ac233d01
commit
303a4df6ef
@ -109,7 +109,7 @@ jobs:
|
||||
|
||||
# docs pull request
|
||||
- name: "docs"
|
||||
if: type IN (push, pull_request)
|
||||
if: type IN (push, pull_request) OR tag IS present
|
||||
language: node_js
|
||||
node_js:
|
||||
- "node"
|
||||
|
1
docs/.gitignore
vendored
1
docs/.gitignore
vendored
@ -9,6 +9,7 @@
|
||||
.cache-loader
|
||||
.vercel
|
||||
/static/img/*.svg
|
||||
vercel.json
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
|
@ -3,7 +3,7 @@
|
||||
Solana's Docs are built using [Docusaurus 2](https://v2.docusaurus.io/) with `npm`.
|
||||
Static content delivery is handled using `vercel`.
|
||||
|
||||
### Installation
|
||||
### Installing Docusaurus
|
||||
|
||||
```
|
||||
$ npm install
|
||||
@ -11,22 +11,23 @@ $ npm install
|
||||
|
||||
### Local Development
|
||||
|
||||
This command starts a local development server and open up a browser window.
|
||||
Most changes are reflected live without having to restart the server.
|
||||
|
||||
```
|
||||
$ npm run start
|
||||
```
|
||||
|
||||
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
|
||||
|
||||
### Build
|
||||
#### Local Build Testing
|
||||
```
|
||||
$ npm run build
|
||||
```
|
||||
### Build Locally
|
||||
|
||||
This command generates static content into the `build` directory and can be
|
||||
served using any static contents hosting service.
|
||||
|
||||
#### CI Build Flow
|
||||
```
|
||||
$ docs/build.sh
|
||||
```
|
||||
|
||||
### CI Build Flow
|
||||
The docs are built and published in Travis CI with the `docs/build.sh` script.
|
||||
On each PR, the docs are built, but not published.
|
||||
|
||||
|
@ -26,20 +26,9 @@ source ../ci/rust-version.sh
|
||||
# Build from /src into /build
|
||||
npm run build
|
||||
|
||||
# Deploy the /build content using vercel
|
||||
if [[ -d .vercel ]]; then
|
||||
rm -r .vercel
|
||||
fi
|
||||
./set-vercel-project-name.sh
|
||||
|
||||
# Publish only from merge commits and release tags
|
||||
if [[ -n $CI ]]; then
|
||||
if [[ -z $CI_PULL_REQUEST ]]; then
|
||||
[[ -n $VERCEL_TOKEN ]] || {
|
||||
echo "VERCEL_TOKEN is undefined. Needed for Vercel authentication."
|
||||
exit 1
|
||||
}
|
||||
vercel deploy . --local-config=vercel.json --confirm --token "$VERCEL_TOKEN" --prod
|
||||
./publish-docs.sh
|
||||
fi
|
||||
else
|
||||
vercel deploy . --local-config=vercel.json
|
||||
fi
|
||||
|
39
docs/publish-docs.sh
Executable file
39
docs/publish-docs.sh
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -d .vercel ]]; then
|
||||
rm -r .vercel
|
||||
fi
|
||||
|
||||
CONFIG_FILE=vercel.json
|
||||
|
||||
if [[ -n $CI_TAG ]]; then
|
||||
PROJECT_NAME=docs-solana-com
|
||||
else
|
||||
eval "$(../ci/channel-info.sh)"
|
||||
case $CHANNEL in
|
||||
edge)
|
||||
PROJECT_NAME=edge-docs-solana-com
|
||||
;;
|
||||
beta)
|
||||
PROJECT_NAME=beta-docs-solana-com
|
||||
;;
|
||||
*)
|
||||
PROJECT_NAME=docs
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
cat > "$CONFIG_FILE" <<EOF
|
||||
{
|
||||
"name": "$PROJECT_NAME",
|
||||
"scope": "solana-labs"
|
||||
}
|
||||
EOF
|
||||
|
||||
[[ -n $VERCEL_TOKEN ]] || {
|
||||
echo "VERCEL_TOKEN is undefined. Needed for Vercel authentication."
|
||||
exit 1
|
||||
}
|
||||
vercel deploy . --local-config="$CONFIG_FILE" --confirm --token "$VERCEL_TOKEN" --prod
|
@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Replaces the PROJECT_NAME value in vercel.json commit based on channel or tag
|
||||
# so we push the updated docs to the right domain
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -n $CI_TAG ]]; then
|
||||
NAME=docs-solana-com
|
||||
else
|
||||
eval "$(../ci/channel-info.sh)"
|
||||
case $CHANNEL in
|
||||
edge)
|
||||
NAME=edge-docs-solana-com
|
||||
;;
|
||||
beta)
|
||||
NAME=beta-docs-solana-com
|
||||
;;
|
||||
*)
|
||||
NAME=docs
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
sed -i s/PROJECT_NAME/$NAME/g vercel.json
|
@ -1,4 +0,0 @@
|
||||
{
|
||||
"name": "PROJECT_NAME",
|
||||
"scope": "solana-labs"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user