Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Performs checks, builds and deploys the mdbook

name: book

on:
push:
branches: [main]
pull_request:
paths:
- 'docs/src/SUMMARY.md'
- 'docs/src/IMPORTED.md'

jobs:
check-files:
name: check interdependent files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check if SUMMARY.md and IMPORTED.md are modified together
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
BASE_SHA=${{ github.event.pull_request.base.sha }}
HEAD_SHA=${{ github.event.pull_request.head.sha }}
else
# For push events, compare with the previous commit
BASE_SHA=${{ github.event.before }}
HEAD_SHA=${{ github.event.after }}
fi

# Check which files were modified
SUMMARY_CHANGED=$(git diff --name-only $BASE_SHA $HEAD_SHA | grep -q "src/docs/SUMMARY.md" && echo "true" || echo "false")
IMPORTED_CHANGED=$(git diff --name-only $BASE_SHA $HEAD_SHA | grep -q "src/docs/IMPORTED.md" && echo "true" || echo "false")

# If one file changed and the other didn't, fail the check
if [[ "$SUMMARY_CHANGED" == "true" && "$IMPORTED_CHANGED" == "false" ]]; then
echo "Error: src/docs/SUMMARY.md was modified but src/docs/IMPORTED.md was not. Please update both files together to make sure the local book and the Miden book are in sync."
exit 1
fi

if [[ "$SUMMARY_CHANGED" == "false" && "$IMPORTED_CHANGED" == "true" ]]; then
echo "Error: src/docs/IMPORTED.md was modified but src/docs/SUMMARY.md was not. Please update both files together to make sure the local book and the Miden book are in sync."
exit 1
fi

echo "Both files were either modified together or not modified at all. Check passes!"

deploy:
name: deploy mdbook
runs-on: ubuntu-latest
needs: check-files
if: github.event_name == 'push' || github.event_name == 'workflow_run'
permissions:
contents: write
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install latest mdBook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Install mdBook plugins
run: |
cargo install mdbook-katex mdbook-linkcheck mdbook-alerts

- name: Build book
run: mdbook build docs/

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "docs/book/html"

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
13 changes: 13 additions & 0 deletions docs/src/IMPORTED.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Summary

- [Tutorials](./index.md)
- [Miden Node Setup](./miden_node_setup.md)
- [Rust-Client](./rust-client/about.md)
- [Creating Accounts and Faucets](./rust-client/create_deploy_tutorial.md)
- [Mint, Consume, and Create Notes](./rust-client/mint_consume_create_tutorial.md)
- [Deploying a Counter Contract](./rust-client/counter_contract_tutorial.md)
- [Interacting with Public Smart Contracts](./rust-client/public_account_interaction_tutorial.md)
- [Foreign Procedure Invocation](./rust-client/foreign_procedure_invocation_tutorial.md)
- [Web-Client](./web-client/about.md)
- [Creating Accounts and Faucets](./web-client/create_deploy_tutorial.md)
- [Mint, Consume, and Create Notes](./web-client/mint_consume_create_tutorial.md)
28 changes: 28 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Summary

[Introduction](./index.md)

---

# Node

- [Miden Node Setup](./miden_node_setup.md)

---

# Rust client

- [Introduction](./rust-client/about.md)
- [Creating Accounts and Faucets](./rust-client/create_deploy_tutorial.md)
- [Mint, Consume, and Create Notes](./rust-client/mint_consume_create_tutorial.md)
- [Deploying a Counter Contract](./rust-client/counter_contract_tutorial.md)
- [Interacting with Public Smart Contracts](./rust-client/public_account_interaction_tutorial.md)
- [Foreign Procedure Invocation](./rust-client/foreign_procedure_invocation_tutorial.md)

---

# Web client

- [Introduction](./web-client/about.md)
- [Creating Accounts and Faucets](./web-client/create_deploy_tutorial.md)
- [Mint, Consume, and Create Notes](./web-client/mint_consume_create_tutorial.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.