Skip to content
Merged
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
22 changes: 22 additions & 0 deletions .github/actions/setup-mdbook/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Install mdbook"
description: "Install mdbook based on Cargo.toml version"

runs:
using: "composite"
steps:
- name: Install mdbook
run: |
REQUIRED_VERSION="$(grep '^mdbook-core' Cargo.toml | sed 's/.*"\([^"]*\)".*/\1/')"
if command -v mdbook >/dev/null 2>&1; then
INSTALLED_VERSION="$(mdbook --version | awk '{print $2}')"
if [ "$INSTALLED_VERSION" = "$REQUIRED_VERSION" ]; then
echo "mdbook $INSTALLED_VERSION is already installed."
else
echo "mdbook $INSTALLED_VERSION is installed but we need $REQUIRED_VERSION. Reinstalling..."
cargo install mdbook --version "$REQUIRED_VERSION" --force
fi
else
echo "mdbook not found. Installing version $REQUIRED_VERSION..."
cargo install mdbook --version "$REQUIRED_VERSION" --force
fi
shell: bash
9 changes: 2 additions & 7 deletions .github/workflows/page.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ jobs:
uses: ./.github/actions/setup-rust

- name: Install mdbook
run: |
if ! command -v mdbook >/dev/null 2>&1; then
cargo install mdbook --version "$(grep '^mdbook' Cargo.toml | sed 's/.*"\([^"]*\)".*/\1/')" --force
else
echo "mdbook is already installed, skipping."
fi
uses: ./.github/actions/setup-mdbook

- name: Run tests
run: cargo test --all-features --verbose

- name: Build book
run: mdbook build docs
run: head -n 5 README.md > docs/src/index.md && mdbook build docs

- name: Deploy to github pages
uses: crazy-max/ghaction-github-pages@v4
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ jobs:
uses: ./.github/actions/setup-rust

- name: Install mdbook
run: |
if ! command -v mdbook >/dev/null 2>&1; then
cargo install mdbook --version "$(grep '^mdbook' Cargo.toml | sed 's/.*"\([^"]*\)".*/\1/')" --force
else
echo "mdbook is already installed, skipping."
fi
uses: ./.github/actions/setup-mdbook

- name: Run tests
run: cargo test --all-features --verbose
Expand Down Expand Up @@ -74,7 +69,7 @@ jobs:

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Install packages
run: sudo apt update && sudo apt install -y upx-ucl zip
Expand Down
Loading
Loading