Skip to content

Commit

Permalink
[ci] make readme generation a just command
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshowers committed Dec 22, 2024
1 parent c6d3e69 commit cc2ef11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ jobs:
uses: taiki-e/install-action@8484225d9734e230a8bf38421a4ffec1cc249372 # v2
with:
tool: cargo-readme
- name: Run cargo readme
run: ./scripts/regenerate-readmes.sh
- name: Generate readmes
run: just generate-readmes
- name: Check for differences
run: git diff --exit-code
# cargo hack might cause changes to Cargo.lock which can cause the git diff above to fail. Put
Expand Down
13 changes: 13 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,16 @@ rustdoc:
| gawk '{ gsub(" v", "@", $0); printf("%s\n", $1); }' \
| xargs printf -- '-p %s\n' \
| RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS='--cfg=doc_cfg' xargs cargo doc --no-deps --lib --all-features

# Generate README.md files from README.tpl and lib.rs files
generate-readmes:
#!/usr/bin/env bash
set -eo pipefail
git ls-files | grep README.tpl$ | while read -r readme; do
echo "Generating README for $readme"
dir=$(dirname "$readme")
cargo readme --project-root "$dir" > "$dir/README.md.tmp"
gawk -f "scripts/fix-readmes.awk" "$dir/README.md.tmp" > "$dir/README.md"
rm "$dir/README.md.tmp"
done
16 changes: 0 additions & 16 deletions scripts/regenerate-readmes.sh

This file was deleted.

0 comments on commit cc2ef11

Please sign in to comment.