Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setup-mdbook action. #2

Merged
merged 3 commits into from
Jun 5, 2024
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
17 changes: 16 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,25 @@ jobs:
- run: uv --version
- run: python -m build --version

setup_mdbook:
name: setup-mdbook [default]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up mdbook
uses: ./setup-mdbook
- run: mdbook --version
- run: mdbook-linkcheck --version

tests_complete:
name: All tests
if: always()
needs: [setup_uv_default, setup_uv_version, setup_uv_lockfile]
needs:
- setup_uv_default
- setup_uv_version
- setup_uv_lockfile
- setup_mdbook
runs-on: ubuntu-latest

steps:
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,27 @@ steps:
with:
python-version: "3.12"
- name: Set up Python environment
uses: glotzerlab/workflows/setup-python@<insert hash of tagged version here> # v0.1.0
uses: glotzerlab/workflows/setup-uv@<insert hash of tagged version here> # v0.1.0
with:
lockfile: "requirements.txt"
```

[uv]: https://github.com/astral-sh/uv

## setup-mdbook

`setup-mdbook` installs [mdbook] and *optionally* installs mdbook plugins:
* [mdbook-linkcheck]

In your action workflow:
```yaml
steps:
- name: Set up mdbook
uses: glotzerlab/workflows/setup-mdbook@<insert hash of tagged version here> # v0.1.0
```

See [setup-mdbook/action.yaml] for all options.

[mdbook]: https://rust-lang.github.io/mdBook/
[mdbook-linkcheck]: https://github.com/Michael-F-Bryan/mdbook-linkcheck
[setup-mdbook/action.yaml]: setup-mdbook/action.yaml
35 changes: 35 additions & 0 deletions setup-mdbook/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Setup mdbook
description: Install mdbook and optional mdbook plugins.

inputs:
mdbook_version:
description: 'mdbook version to install.'
required: false
default: '0.4.40'
linkcheck:
description: 'Whether to install mdbook-linkcheck.'
required: false
default: 'true'
linkcheck_version:
description: 'mdbook-linkcheck version to install.'
required: false
default: '0.7.7'
platform:
description: 'Download executables for the given platform.'
required: false
default: x86_64-unknown-linux-gnu

runs:
using: "composite"
steps:
- name: Install mdbook
run: |
mkdir -p "$HOME/.cargo/bin"
curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v${{ inputs.mdbook_version }}/mdbook-v${{ inputs.mdbook_version }}-${{ inputs.platform }}.tar.gz" | tar -xvz --directory "$HOME/.cargo/bin"
shell: bash
- name: Install mdbook-linkcheck
run: |
curl -sSL "https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v${{ inputs.linkcheck_version }}/mdbook-linkcheck.${{ inputs.platform }}.zip" -o mdbook-linkcheck.zip
unzip mdbook-linkcheck.zip -d "$HOME/.cargo/bin"
chmod a+x "$HOME/.cargo/bin/mdbook-linkcheck"
shell: bash