Skip to content
Merged
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
20 changes: 13 additions & 7 deletions .github/workflows/DocCleanup.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
name: Doc Cleanup
on:
push:
branches:
- gh-pages
# runs on the 1st day of every month at 03:00 UTC
schedule:
- cron: '0 3 1 * *'
workflow_dispatch:
permissions:
contents: write
jobs:
doc-cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout gh-pages branch
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
ref: gh-pages
- name: Delete old docs
run: |
keep=$(readlink stable)
keep="$(readlink stable)"
git config user.name "Documenter.jl"
git config user.email "documenter@juliadocs.github.io"
git rm -rf v[0-9]*.[0-9]* && git checkout HEAD -- $keep
if git commit -m "keep latest docs only" ; then
git rm -rf --ignore-unmatch "v[0-9]*.[0-9]*" "previews/*"
git checkout HEAD -- "$keep"
if git diff --cached --quiet; then
echo "No old docs or previews to delete"
else
git commit -m "Delete old docs and previews"
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
git push --force origin gh-pages-new:gh-pages
fi