name: Cargo Create Docs on: push: branches: [main] pull_request: branches: [main] env: CARGO_TERM_COLOR: always RUSTFLAGS: "-Dwarnings" jobs: build-rust-doc: name: Zombienet SDK - Rust Docs runs-on: ubuntu-latest strategy: matrix: toolchain: # TODO 24-02-08: Disable nightly due to tkaitchuck/aHash#200. #- nightly - stable steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Init nigthly install for fmt run: rustup update nightly && rustup default nightly && rustup component add rustfmt - name: Check format run: cargo +nightly fmt --check --all - name: Init install run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }} && rustup component add clippy - name: install_deps run: sudo apt-get update && sudo apt-get install protobuf-compiler - name: Create docs run: | cargo doc --no-deps echo "" > target/doc/index.html - name: Move docs run: | mkdir -p ./doc mv ./target/doc/* ./doc git config user.email "github-action@users.noreply.github.com" git config user.name "GitHub Action" git config user.password "${{ secrets.GH_PAGES_TOKEN }}" git checkout --orphan gh-pages mkdir to_delete shopt -s extglob mv !(to_delete) ./to_delete mv ./to_delete/doc/* . rm -rf ./to_delete git add --all git commit -m "Documentation" shell: bash # Necessary for `shopt` to work - run: git push -f origin gh-pages:gh-pages if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}