diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 000000000000..e3127b7457e7
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,125 @@
+on:
+ pull_request:
+ push:
+ branches: [master]
+
+name: Docs
+
+jobs:
+ set-image:
+ runs-on: ubuntu-latest
+ outputs:
+ IMAGE: ${{ steps.set_image.outputs.IMAGE }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - id: set_image
+ run: cat .github/env >> $GITHUB_OUTPUT
+ test-rustdoc:
+ runs-on: arc-runners-beefy-stg
+ needs: [set-image]
+ container:
+ image: ${{ needs.set-image.outputs.IMAGE }}
+ steps:
+ - uses: actions/checkout@v4
+ - run: time cargo doc --workspace --all-features --no-deps
+ env:
+ SKIP_WASM_BUILD: 1
+ test-doc:
+ runs-on: arc-runners-beefy-stg
+ needs: [set-image, test-rustdoc]
+ container:
+ image: ${{ needs.set-image.outputs.IMAGE }}
+ steps:
+ - uses: actions/checkout@v4
+ - run: time cargo test --doc --workspace
+ env:
+ RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
+
+ build-rustdoc:
+ runs-on: arc-runners-beefy-stg
+ needs: [set-image]
+ container:
+ image: ${{ needs.set-image.outputs.IMAGE }}
+ steps:
+ - uses: actions/checkout@v4
+ - run: time cargo doc --all-features --workspace --no-deps
+ env:
+ SKIP_WASM_BUILD: 1
+ RUSTDOCFLAGS: "-Dwarnings --default-theme=ayu --html-in-header ./docs/sdk/assets/header.html --extend-css ./docs/sdk/assets/theme.css --html-after-content ./docs/sdk/assets/after-content.html"
+ - run: rm -f ./target/doc/.lock
+ - run: mv ./target/doc ./crate-docs
+ - name: Inject Simple Analytics script
+ run: |
+ script_content=""
+ docs_dir="./crate-docs"
+
+ inject_simple_analytics() {
+ find "$1" -name '*.html' | xargs -I {} -P "$(nproc)" bash -c 'file="{}"; echo "Adding Simple Analytics script to $file"; sed -i "s||'"$2"'|" "$file";'
+ }
+
+ inject_simple_analytics "$docs_dir" "$script_content"
+ - run: echo "" > ./crate-docs/index.html
+ - uses: actions/upload-artifact@v4
+ with:
+ name: ${{ github.sha }}-doc
+ path: ./crate-docs/
+ retention-days: 1
+ if-no-files-found: error
+
+ build-implementers-guide:
+ runs-on: ubuntu-latest
+ container:
+ image: paritytech/mdbook-utils:e14aae4a-20221123
+ options: --user root
+ steps:
+ - uses: actions/checkout@v4
+ - run: mdbook build ./polkadot/roadmap/implementers-guide
+ - run: mkdir -p artifacts
+ - run: mv polkadot/roadmap/implementers-guide/book artifacts/
+ - uses: actions/upload-artifact@v4
+ with:
+ name: ${{ github.sha }}-guide
+ path: ./artifacts/
+ retention-days: 1
+ if-no-files-found: error
+
+ publish-rustdoc:
+ if: github.ref == 'refs/heads/master'
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ needs: [build-rustdoc, build-implementers-guide]
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: gh-pages
+ - name: Ensure destination dir does not exist
+ run: |
+ rm -rf book/
+ rm -rf ${REF_NAME}
+ env:
+ REF_NAME: ${{ github.head_ref || github.ref_name }}
+ - name: Download rustdocs
+ uses: actions/download-artifact@v4
+ with:
+ name: ${{ github.sha }}-doc
+ path: ${{ github.head_ref || github.ref_name }}
+ - name: Download guide
+ uses: actions/download-artifact@v4
+ with:
+ name: ${{ github.sha }}-guide
+ path: /tmp
+ - run: mkdir -p book
+ - name: Move book files
+ run: mv /tmp/book/html/* book/
+ - name: push
+ uses: github-actions-x/commit@v2.9
+ with:
+ github-token: ${{ github.token }}
+ push-branch: "gh-pages"
+ commit-message: "___Updated docs for ${{ github.head_ref || github.ref_name }}___"
+ force-add: "true"
+ files: ${{ github.head_ref || github.ref_name }}/ book/
+ name: devops-parity
+ email: devops-team@parity.io