Publish Docs #574
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
name: "Publish Docs" | |
on: | |
workflow_run: | |
workflows: ["CI"] | |
branches: [master] | |
types: | |
- completed | |
jobs: | |
publishing: | |
name: Publish Documentation | |
runs-on: ubuntu-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: π₯ Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
repository: input-output-hk/hydra | |
ref: release | |
# Also ensure we have all history with all tags | |
fetch-depth: 0 | |
- name: π₯ Download released hydra-spec | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
repo: input-output-hk/hydra | |
workflow: ci-nix.yaml | |
workflow_conclusion: success | |
branch: release | |
name: hydra-spec | |
path: docs/static | |
- name: π₯ Download released benchmarks | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
repo: input-output-hk/hydra | |
workflow: ci-nix.yaml | |
workflow_conclusion: success | |
branch: release | |
name: benchmarks | |
path: docs/benchmarks | |
- name: π₯ Download released test-results | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
repo: input-output-hk/hydra | |
workflow: ci-nix.yaml | |
workflow_conclusion: success | |
branch: release | |
name: test-results | |
path: docs/benchmarks/tests | |
- name: π₯ Download released haddock documentation | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
repo: input-output-hk/hydra | |
workflow: ci-nix.yaml | |
workflow_conclusion: success | |
branch: release | |
name: haddocks | |
path: docs/static/haddock | |
- name: Build documentation + latest monthly | |
working-directory: docs | |
run: | | |
# Use monthly reports (blog) from master | |
git checkout origin/master -- monthly/ | |
# TODO: what to do about broken links from monthly -> ? | |
sed -i 's|onBrokenLinks: "throw"|onBrokenLinks: "warn"|' docusaurus.config.js | |
yarn | |
yarn build | |
mkdir -p /tmp/public | |
mv build /tmp/public/head-protocol | |
# Clean the working copy | |
git clean -dxf | |
- name: Checkout master | |
working-directory: docs | |
run: | | |
git reset origin/master --hard | |
sed -i 's|head-protocol|head-protocol/unstable|' docusaurus.config.js | |
- name: π₯ Download latest hydra-spec | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
repo: input-output-hk/hydra | |
workflow: ci-nix.yaml | |
workflow_conclusion: success | |
branch: master | |
name: hydra-spec | |
path: docs/static | |
- name: π₯ Download latest benchmarks | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
repo: input-output-hk/hydra | |
workflow: ci-nix.yaml | |
workflow_conclusion: success | |
branch: master | |
name: benchmarks | |
path: docs/benchmarks | |
- name: π₯ Download latest test-results | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
repo: input-output-hk/hydra | |
workflow: ci-nix.yaml | |
workflow_conclusion: success | |
branch: master | |
name: test-results | |
path: docs/benchmarks/tests | |
- name: π₯ Download latest haddock documentation | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
repo: input-output-hk/hydra | |
workflow: ci-nix.yaml | |
workflow_conclusion: success | |
branch: master | |
name: haddocks | |
path: docs/static/haddock | |
- name: Build /unstable documentation | |
working-directory: docs | |
run: | | |
yarn | |
yarn build | |
mv build /tmp/public/head-protocol/unstable | |
- name: π Create redirect | |
run: | | |
echo "hydra.family" > /tmp/public/CNAME | |
echo '<!DOCTYPE html><html><head><meta http-equiv="Refresh" content="0; URL=https://hydra.family/head-protocol"></head></html>' > /tmp/public/index.html | |
- name: π’ Publish Documentation | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN || github.token }} | |
publish_dir: /tmp/public | |
enable_jekyll: true | |
force_orphan: true |