bdk 0.30.2

A modern, lightweight, descriptor-based wallet library
Documentation
name: Publish Nightly Docs

on:
  push:
    branches:
      - 'master'
      - 'release/*'
  pull_request:
    branches:
      - 'master'
      - 'release/*'

jobs:
  build_docs:
    name: Build docs
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout sources
        uses: actions/checkout@v4
      - name: Setup cache
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: nightly-docs-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@nightly
        with:
          components: clippy, rustfmt
      - name: Cargo update
        run: cargo update
      - name: Build docs
        run: cargo rustdoc --verbose --features=compiler,electrum,esplora,use-esplora-blocking,compact_filters,rpc,key-value-db,sqlite,all-keys,verify,hardware-signer -- --cfg docsrs -Dwarnings
      - name: Upload artifact
        uses: actions/upload-artifact@v4
        with:
          name: built-docs
          path: ./target/doc/*

  publish_docs:
    name: 'Publish docs'
    if: github.ref == 'refs/heads/master'
    needs: [build_docs]
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout `bitcoindevkit.org`
        uses: actions/checkout@v4
        with:
          ssh-key: ${{ secrets.DOCS_PUSH_SSH_KEY }}
          repository: bitcoindevkit/bitcoindevkit.org
          ref: master
      - name: Create directories
        run: mkdir -p ./docs/.vuepress/public/docs-rs/bdk/nightly
      - name: Remove old latest
        run: rm -rf ./docs/.vuepress/public/docs-rs/bdk/nightly/latest
      - name: Download built docs
        uses: actions/download-artifact@v1
        with:
          name: built-docs
          path: ./docs/.vuepress/public/docs-rs/bdk/nightly/latest
      - name: Configure git
        run: git config user.email "github-actions@github.com" && git config user.name "github-actions"
      - name: Commit
        continue-on-error: true         # If there's nothing to commit this step fails, but it's fine
        run: git add ./docs/.vuepress/public/docs-rs && git commit -m "Publish autogenerated nightly docs"
      - name: Push
        run: git push origin master