Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not optimize docusaurus build #880

Merged
merged 2 commits into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -385,31 +385,29 @@ jobs:
name: hydra-spec
path: docs/static/

- name: 📚 Documentation
- name: 📚 Documentation sanity check
if: github.ref_name != 'master' && github.ref_name != 'release'
working-directory: docs
run: |
yarn && yarn build
mkdir -p public/
mv build/* public/

- name: 💾 Upload docs artifact
uses: actions/upload-artifact@v3
with:
name: docs-stable
pgrange marked this conversation as resolved.
Show resolved Hide resolved
path: docs/public
yarn && yarn build-dev

- name: 📚 Documentation (unstable)
if: github.ref_name != 'release'
- name: 📚 Prepare Documentation (unstable)
if: github.ref_name == 'master'
working-directory: docs
run: |
sed -i 's|head-protocol|head-protocol/unstable|' docusaurus.config.js

- name: 📚 Documentation
if: github.ref_name == 'master' || github.ref_name == 'release'
working-directory: docs
run: |
yarn && yarn build
mkdir -p public/unstable
mv build/* public/unstable
mkdir public
mv build/* public

- name: 💾 Upload docs artifact (unstable) - only master branch
if: github.ref_name == 'master'
- name: 💾 Upload docs artifact
if: github.ref_name == 'master' || github.ref_name == 'release'
uses: actions/upload-artifact@v3
with:
name: docs-unstable
path: docs/public/unstable
name: docs
path: docs/public
45 changes: 28 additions & 17 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Publish Docs"
on:
workflow_run:
workflows: ["CI"]
branches: [master, release]
branches: [master]
types:
- completed

Expand All @@ -13,50 +13,62 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:

- name: 📥 Download last released docs
uses: dawidd6/action-download-artifact@v2
with:
workflow: ci.yaml
workflow_conclusion: success
branch: release
name: docs-stable
name: docs
path: docs-release
# TODO: backward compatibility
# remove the following line to throw an error instead
# of a warning if artifact is not found when we have
# a release branch with artifact name docs instead of
# docs-stable
if_no_artifact_found: warn

- name: 📥 Download latest docs
# TODO: backward compatibility
# remove the following block when we have
# a release branch with artifact name docs instead of
# docs-stable
- name: 📥 Download last released docs
uses: dawidd6/action-download-artifact@v2
with:
workflow: ci.yaml
workflow_conclusion: success
branch: master
branch: release
name: docs-stable
path: docs-master
path: docs-release
if_no_artifact_found: ignore

- name: 📥 Download latest /unstable docs
- name: 📥 Download latest unstable docs
uses: dawidd6/action-download-artifact@v2
with:
workflow: ci.yaml
workflow_conclusion: success
branch: master
name: docs-unstable
path: docs-master-unstable
name: docs
path: docs-unstable

- name: 🪓 Piece together docs
run: |
mkdir public
mv docs-release public/head-protocol
mv docs-master-unstable public/head-protocol/unstable
mv docs-unstable public/head-protocol/unstable
# Always use monthly reports from master
# XXX: This depends on languages and assets are annoying
rm -r public/head-protocol/monthly
mv docs-master/monthly public/head-protocol/monthly
cp -r public/head-protocol/unstable/monthly public/head-protocol/monthly
rm -r public/head-protocol/ja/monthly
mv docs-master/ja/monthly public/head-protocol/ja/monthly
cp -r public/head-protocol/unstable/ja/monthly public/head-protocol/monthly
rm -r public/head-protocol/fr/monthly
mv docs-master/fr/monthly public/head-protocol/fr/monthly
cp -r public/head-protocol/unstable/fr/monthly public/head-protocol/monthly
# XXX: Need to copy assets as well. This will also litter with unrelated assets (js)
cp -r docs-master/assets/* public/head-protocol/assets/
cp -r docs-master/ja/assets/* public/head-protocol/ja/assets/
cp -r docs-master/fr/assets/* public/head-protocol/fr/assets/
cp -r public/head-protocol/unstable/assets/* public/head-protocol/assets/
cp -r public/head-protocol/unstable/ja/assets/* public/head-protocol/ja/assets/
cp -r public/head-protocol/unstable/fr/assets/* public/head-protocol/fr/assets/

- name: 👉 Create redirect
run: |
Expand All @@ -69,5 +81,4 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN || github.token }}
publish_dir: public
enable_jekyll: true
force_orphan: true

force_orphan: true
1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"docusaurus": "docusaurus",
"prepare": "yarn enrich-document-metadata && yarn regenerate-plantuml",
"build": "yarn prepare && docusaurus build",
"build-dev": "yarn prepare && docusaurus build --no-minify",
"start": "yarn dummy-spec && docusaurus start",
"validate:inputs": "./validate-api.js publish '/' '../hydra-node/golden/ReasonablySized (ClientInput (Tx BabbageEra)).json'",
"validate:outputs": "./validate-api.js subscribe '/' '../hydra-node/golden/ReasonablySized (TimedServerOutput (Tx BabbageEra)).json'",
Expand Down