mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-07-10 11:04:10 -04:00
ci: add docs/patches overlay for versioned docs
This commit is contained in:
parent
63e741420d
commit
9835d9129a
1 changed files with 7 additions and 2 deletions
9
.github/workflows/sync-website.yml
vendored
9
.github/workflows/sync-website.yml
vendored
|
|
@ -36,16 +36,21 @@ jobs:
|
|||
rm -rf "$TARGET"
|
||||
mkdir -p "$TARGET"
|
||||
|
||||
# Copy current docs as "(git)"
|
||||
# Copy current docs as "(git)", excluding patches dir
|
||||
cp -r docs "$TARGET/(git)"
|
||||
rm -rf "$TARGET/(git)/patches"
|
||||
|
||||
# Generate versioned docs from last 2 semver tags
|
||||
tags=$(git tag --sort=-v:refname | grep '^v\?[0-9]\+\.[0-9]\+\.[0-9]\+$' | head -2)
|
||||
for tag in $tags; do
|
||||
name="v${tag#v}"
|
||||
git worktree add /tmp/docs-"$tag" "$tag" || continue
|
||||
if [ -d "/tmp/docs-$tag/docs" ]; then
|
||||
name="v${tag#v}"
|
||||
cp -r "/tmp/docs-$tag/docs" "$TARGET/$name"
|
||||
# Overlay any patches for this version
|
||||
if [ -d "docs/patches/$name" ]; then
|
||||
cp -r "docs/patches/$name"/* "$TARGET/$name/"
|
||||
fi
|
||||
jq --arg title "$name" --arg desc "$name release" \
|
||||
'.title = $title | .description = $desc | .root = true' \
|
||||
"$TARGET/$name/meta.json" > "$TARGET/$name/meta.json.tmp" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue