]> Untitled Git - bdk/commitdiff
[ci] Build and publish nightly docs
authorAlekos Filini <alekos.filini@gmail.com>
Thu, 3 Dec 2020 14:00:04 +0000 (15:00 +0100)
committerAlekos Filini <alekos.filini@gmail.com>
Thu, 3 Dec 2020 18:05:06 +0000 (19:05 +0100)
.github/workflows/nightly_docs.yml [new file with mode: 0644]

diff --git a/.github/workflows/nightly_docs.yml b/.github/workflows/nightly_docs.yml
new file mode 100644 (file)
index 0000000..d3ad4ab
--- /dev/null
@@ -0,0 +1,63 @@
+name: Publish Nightly Docs
+
+on:
+  push:
+    branches:
+      - master
+
+jobs:
+  build_docs:
+    name: Build docs
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout sources
+        uses: actions/checkout@v2
+      - name: Setup cache
+        uses: actions/cache@v2
+        with:
+          path: |
+            ~/.cargo/registry
+            ~/.cargo/git
+            target
+          key: nightly-docs-${{ hashFiles('**/Cargo.toml','**/Cargo.lock') }}
+      - name: Install nightly toolchain
+        uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: nightly
+          override: true
+      - name: Build docs
+        uses: actions-rs/cargo@v1
+        with:
+          command: rustdoc
+          args: --verbose --features=compiler,electrum,esplora,compact_filters,key-value-db,all-keys -- --cfg docsrs
+      - name: Upload artifact
+        uses: actions/upload-artifact@v2
+        with:
+          name: built-docs
+          path: ./target/doc/*
+
+  publish_docs:
+    name: 'Publish docs'
+    needs: [build_docs]
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout `bitcoindevkit.org`
+        uses: actions/checkout@v2
+        with:
+          ssh-key: ${{ secrets.DOCS_PUSH_SSH_KEY }}
+          repository: bitcoindevkit/bitcoindevkit.org
+          ref: master
+      - name: Create directories
+        run: mkdir -p ./static/docs-rs/bdk/nightly
+      - name: Remove old latest
+        run: rm -rf ./static/docs-rs/bdk/nightly/latest
+      - name: Download built docs
+        uses: actions/download-artifact@v1
+        with:
+          name: built-docs
+          path: ./static/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 and push
+        run: git add ./static && git commit -m "Publish autogenerated nightly docs" && git push origin master