Skip to content

Commit 7b3fe9f

Browse files
authored
Merge pull request #1 from JuliaEarth/doc-cleanup
Add "Doc Cleanup" action
2 parents 97a0954 + fc62bdf commit 7b3fe9f

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/DocCleanup.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Doc Cleanup
2+
on:
3+
push:
4+
branches:
5+
- gh-pages
6+
workflow_dispatch:
7+
jobs:
8+
doc-cleanup:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout gh-pages branch
12+
uses: actions/checkout@v4
13+
with:
14+
ref: gh-pages
15+
- name: Delete old docs
16+
run: |
17+
keep=$(readlink stable)
18+
git config user.name "Documenter.jl"
19+
git config user.email "documenter@juliadocs.github.io"
20+
git rm -rf v[0-9]*.[0-9]* && git checkout HEAD -- $keep
21+
if git commit -m "keep latest docs only" ; then
22+
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree})
23+
git push --force origin gh-pages-new:gh-pages
24+
fi

0 commit comments

Comments
 (0)