-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update doc preview cleanup CI job (#248)
- Loading branch information
1 parent
0f84999
commit f3e9fd9
Showing
1 changed file
with
10 additions
and
8 deletions.
There are no files selected for viewing
18 changes: 10 additions & 8 deletions
18
.github/workflows/CleanupDocPreview.yml → .github/workflows/DocPreviewCleanup.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
name: Cleanup Doc Preview | ||
name: Doc Preview Cleanup | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
cleanup-doc-preview: | ||
doc-preview-cleanup: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout gh-pages branch | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: gh-pages | ||
- name: Delete preview | ||
- name: Delete preview and history + push changes | ||
run: | | ||
if [ -d "previews/PR$PRNUM" ]; then | ||
git config user.name "Documenter.jl" | ||
git config user.email "documenter@juliadocs.github.io" | ||
git rm -rf "previews/PR$PRNUM" | ||
git commit -m "delete preview for $PRNUM" | ||
git push origin gh-pages:gh-pages | ||
git commit -m "delete preview" | ||
git branch gh-pages-new $(echo "delete history" | git commit-tree HEAD^{tree}) | ||
git push --force origin gh-pages-new:gh-pages | ||
fi | ||
env: | ||
PRNUM: ${{ github.event.number }} | ||
|
||
# adapted from here: | ||
# copied from here: | ||
# https://juliadocs.github.io/Documenter.jl/stable/man/hosting/#gh-pages-Branch | ||
# without history cleanup |