Fix Quartz build to preserve git history for accurate file dates (#105)
## Summary Fixes the "isn't yet tracked by git, dates will be inaccurate" warnings in the Build docs step by restructuring how Quartz builds the documentation. ## Problem Previously, we copied docs into Quartz's content folder. Since this was inside a fresh Quartz clone with no history of our files, the `CreatedModifiedDate` plugin couldn't determine accurate dates. ## Solution Build Quartz from within the blumeops repo instead: 1. Copy Quartz's build system (quartz/, package.json, etc.) into the workspace 2. Symlink `content` -> `docs` (preserves git history) 3. Symlink `docs/CHANGELOG.md` -> `../CHANGELOG.md` 4. Build from workspace root where git can trace file history 5. Clean up artifacts after creating tarball ## Deployment and Testing - [ ] Run build workflow and verify no "not tracked by git" warnings - [ ] Verify file dates appear correctly on built docs site Reviewed-on: https://forge.ops.eblu.me/eblume/blumeops/pulls/105
This commit is contained in:
parent
1835e3e80e
commit
03bda41de4
5 changed files with 29 additions and 15 deletions
|
|
@ -147,35 +147,47 @@ jobs:
|
|||
echo "Node version: $(node --version)"
|
||||
echo "NPM version: $(npm --version)"
|
||||
|
||||
# Clone Quartz
|
||||
# Clone Quartz to temp location
|
||||
git clone --depth 1 https://github.com/jackyzha0/quartz.git /tmp/quartz
|
||||
cd /tmp/quartz
|
||||
|
||||
# Copy Quartz build system into blumeops workspace
|
||||
# This allows building from within the repo so git can find file history
|
||||
cp -r /tmp/quartz/quartz "$GITHUB_WORKSPACE/"
|
||||
cp /tmp/quartz/package.json "$GITHUB_WORKSPACE/"
|
||||
cp /tmp/quartz/package-lock.json "$GITHUB_WORKSPACE/"
|
||||
cp /tmp/quartz/tsconfig.json "$GITHUB_WORKSPACE/"
|
||||
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
|
||||
# Install dependencies
|
||||
npm ci
|
||||
|
||||
# Copy our configuration (lives in docs/ to keep repo root clean)
|
||||
cp "$GITHUB_WORKSPACE/docs/quartz.config.ts" .
|
||||
cp "$GITHUB_WORKSPACE/docs/quartz.layout.ts" .
|
||||
# Copy our configuration to workspace root
|
||||
cp docs/quartz.config.ts .
|
||||
cp docs/quartz.layout.ts .
|
||||
|
||||
# Copy docs as content (includes index.md)
|
||||
rm -rf content
|
||||
cp -r "$GITHUB_WORKSPACE/docs" content
|
||||
# Symlink docs as content (preserves git history for accurate dates)
|
||||
ln -s docs content
|
||||
|
||||
# Copy CHANGELOG.md from repo root into content so it's accessible in docs
|
||||
cp "$GITHUB_WORKSPACE/CHANGELOG.md" content/
|
||||
# Symlink CHANGELOG.md into docs so it's part of the content
|
||||
ln -s ../CHANGELOG.md docs/CHANGELOG.md
|
||||
|
||||
# Build
|
||||
# Build (from within repo so git commands work)
|
||||
echo "Building static site..."
|
||||
npx quartz build
|
||||
|
||||
# Create tarball
|
||||
TARBALL="docs-${VERSION}.tar.gz"
|
||||
echo "Creating tarball: $TARBALL"
|
||||
tar -czf "$GITHUB_WORKSPACE/$TARBALL" -C public .
|
||||
tar -czf "$TARBALL" -C public .
|
||||
|
||||
echo "Build complete!"
|
||||
ls -lh "$GITHUB_WORKSPACE/$TARBALL"
|
||||
ls -lh "$TARBALL"
|
||||
|
||||
# Clean up Quartz build artifacts (keep tarball)
|
||||
rm -rf quartz content public node_modules
|
||||
rm -f package.json package-lock.json tsconfig.json quartz.config.ts quartz.layout.ts
|
||||
rm -f docs/CHANGELOG.md # Remove symlink
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
|
|
|
|||
1
docs/changelog.d/fix-quartz-git-dates.doc.md
Normal file
1
docs/changelog.d/fix-quartz-git-dates.doc.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix misc changelog fragment type to show content (was showing empty entries)
|
||||
1
docs/changelog.d/fix-quartz-git-dates.infra.md
Normal file
1
docs/changelog.d/fix-quartz-git-dates.infra.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
Fix Quartz build to preserve git history for accurate file dates
|
||||
|
|
@ -56,7 +56,7 @@ Fragments are automatically collected into `CHANGELOG.md` (at repo root) during
|
|||
| `bugfix` | `bugfix/` | Bug fixes |
|
||||
| `infra` | `infra/` | Infrastructure changes |
|
||||
| `doc` | `doc/` | Documentation updates |
|
||||
| `misc` | `misc/` | Other (content hidden in changelog) |
|
||||
| `misc` | `misc/` | Other changes |
|
||||
|
||||
## Runner Environment
|
||||
|
||||
|
|
|
|||
|
|
@ -37,4 +37,4 @@ showcontent = true
|
|||
[[tool.towncrier.type]]
|
||||
directory = "misc"
|
||||
name = "Miscellaneous"
|
||||
showcontent = false
|
||||
showcontent = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue