-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): versioned documentation between HEAD and release (#470)
* wip improved website * work on versioning * try swizzling version dropdown * swizzle version link * push latest docs * revert to the original workspace config * use substrate workspace plugin (#472) * feat(release): use cargo workspace plugin (#473) * use substrate workspace plugin * fix examples * Add examples to release please * fix versioning * try removing comments * test release pleaes features * complete doc changes for release vs latest * fix examples paths * cleanup pr * try creating workflows for deploying docs * test actions * get workflow registered * try again to get workflow registered * remove extraneous dependencies * remove docs usage * temporarily use main environment * try again * test * fix deploy docs action * add back checkoutv3 * finalize docs deploy strategy * fix copy * try removing substrate api examples until it compiles * try rerunning CI-main * undo * extract deployment to bash scripts * make scripts executable * fix variable usage * fix argument parsing * fix globs * support branch docs * fix deploy script * fix deploy script * migrate to docusaurus 3.7 and fix deploy script * modify site-config.json in deploy * fix heredoc usage * test api doc deploy * remove push CI * fix api deploy script * clean up workflow yaml * remove iarna toml
- Loading branch information
Showing
134 changed files
with
10,584 additions
and
9,761 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: CI | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: deploy-api-docs | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
DOCS_NAME: ${{ inputs.name || github.ref.name }} | ||
PUBLIC_DOCS_DIR: /Users/rohan/Downloads/substrate_docs_public | ||
|
||
jobs: | ||
deploy-api-docs: | ||
name: Deploy API documentation | ||
runs-on: bwrc | ||
environment: docs | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@ddcac349402ef55840d9870785f4df1890768078 | ||
- run: ./deploy.sh ${{ env.PUBLIC_DOCS_DIR }} ${{ inputs.name || github.ref_name }} | ||
working-directory: docs/api | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_API }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: deploy-docs | ||
|
||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
DOCS_NAME: ${{ inputs.name || github.ref.name }} | ||
PUBLIC_DOCS_DIR: /Users/rohan/Downloads/substrate_docs_public | ||
|
||
jobs: | ||
deploy-docs: | ||
name: Deploy documentation | ||
runs-on: bwrc | ||
environment: docs | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
cache: 'yarn' | ||
cache-dependency-path: docs/docusaurus/yarn.lock | ||
- run: ./deploy.sh ${{ env.PUBLIC_DOCS_DIR }} ${{ inputs.name || github.ref_name }} | ||
working-directory: docs/docusaurus | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN_DOCS }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: deploy-release-api-docs | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
deploy-api-docs: | ||
uses: ./.github/workflows/deploy-api-docs.yml | ||
with: | ||
name: release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
use snippets::build_snippets; | ||
|
||
fn main() { | ||
println!("cargo::rerun-if-changed=examples/example.rs"); | ||
build_snippets( | ||
concat!( | ||
env!("CARGO_MANIFEST_DIR"), | ||
"/../substrate/examples/substrate.rs" | ||
), | ||
"substrate", | ||
let example_path = concat!( | ||
env!("CARGO_MANIFEST_DIR"), | ||
"/../examples/latest/substrate_api_examples/src/lib.rs" | ||
); | ||
println!("cargo::rerun-if-changed={example_path}"); | ||
build_snippets(example_path, "substrate"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Print commands that are executed | ||
set -x | ||
|
||
# Turn on error checking options | ||
# Running the bashrc can result in errors, | ||
# which we'll just ignore. | ||
set -euf -o pipefail | ||
|
||
if [ $# -le 1 ]; then | ||
echo "Usage: ./deploy.sh PUBLIC_DOCS_DIR REF_NAME" | ||
exit 1 | ||
fi | ||
|
||
PUBLIC_DOCS_DIR=$1 | ||
REF_NAME=$2 | ||
|
||
just build | ||
rm -rf $PUBLIC_DOCS_DIR/api/static/$REF_NAME | ||
mkdir -p $PUBLIC_DOCS_DIR/api/static/$REF_NAME | ||
cp -r ./target/doc/. $PUBLIC_DOCS_DIR/api/static/$REF_NAME | ||
cd $PUBLIC_DOCS_DIR/api | ||
flyctl deploy --remote-only --detach |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
authors: | ||
- rohanku | ||
slug: /example-post | ||
description: Test description | ||
--- | ||
|
||
# Example post | ||
|
||
Test |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
(cd $SCRIPT_DIR \ | ||
&& yarn docusaurus docs:version $1 \ | ||
&& echo "{\"examples_path\": \"examples/$1\"}" > "versioned_docs/version-$1/docs-config.json") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Print commands that are executed | ||
set -x | ||
|
||
# Turn on error checking options | ||
# Running the bashrc can result in errors, | ||
# which we'll just ignore. | ||
set -euf -o pipefail | ||
|
||
if [ $# -eq 0 ] | ||
then | ||
echo "Usage: ./deploy.sh PUBLIC_DOCS_DIR REF_NAME" | ||
exit 1 | ||
fi | ||
|
||
PUBLIC_DOCS_DIR=$1 | ||
REF_NAME=$2 | ||
|
||
cat << EOF > ./site-config.json | ||
{ | ||
"branch": "$REF_NAME" | ||
} | ||
EOF | ||
yarn install | ||
yarn build | ||
if [ $REF_NAME = "main" ]; then | ||
find $PUBLIC_DOCS_DIR/docusaurus/static -not -path "$PUBLIC_DOCS_DIR/docusaurus/static/branch/*" -not -name "fly.toml" -not -name "Dockerfile" -delete | ||
mkdir -p $PUBLIC_DOCS_DIR/docusaurus/static | ||
cp -r ./build/. $PUBLIC_DOCS_DIR/docusaurus/static | ||
else | ||
rm -rf $PUBLIC_DOCS_DIR/docusaurus/static/branch/$REF_NAME | ||
mkdir -p $PUBLIC_DOCS_DIR/docusaurus/static/branch/$REF_NAME | ||
cp -r ./build/. $PUBLIC_DOCS_DIR/docusaurus/static/branch/$REF_NAME | ||
fi | ||
cd $PUBLIC_DOCS_DIR/docusaurus | ||
flyctl deploy --remote-only --detach |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.