Skip to content

Commit 50cfaf3

Browse files
eliascarvCopilot
andauthored
Add Doc Cleanup action & Show only latest docs (#323)
* Add Doc Cleanup action & Show only latest docs * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Update messages --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 3c9fea3 commit 50cfaf3

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

.github/workflows/DocCleanup.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Doc Cleanup
2+
on:
3+
# runs on the 1st day of every month at 03:00 UTC
4+
schedule:
5+
- cron: '0 3 1 * *'
6+
workflow_dispatch:
7+
permissions:
8+
contents: write
9+
jobs:
10+
doc-cleanup:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout gh-pages branch
14+
uses: actions/checkout@v7
15+
with:
16+
ref: gh-pages
17+
- name: Delete old docs
18+
run: |
19+
keep="$(readlink stable)"
20+
git config user.name "Documenter.jl"
21+
git config user.email "documenter@juliadocs.github.io"
22+
git rm -rf --ignore-unmatch v[0-9]*.[0-9]*
23+
git checkout HEAD -- "$keep"
24+
if git diff --cached --quiet; then
25+
echo "No old docs to delete"
26+
else
27+
git commit -m "Keep latest docs only"
28+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
29+
git push --force origin gh-pages-new:gh-pages
30+
fi

docs/make.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ makedocs(;
2121
]
2222
)
2323

24-
deploydocs(; repo="github.com/JuliaML/TableTransforms.jl", devbranch="master", push_preview=true)
24+
deploydocs(;
25+
repo="github.com/JuliaML/TableTransforms.jl",
26+
versions=["stable" => "v^", "dev" => "dev"],
27+
devbranch="master",
28+
push_preview=true
29+
)

0 commit comments

Comments
 (0)