Skip to content

Commit ed3ccf8

Browse files
authored
Merge pull request #624 from mkitti/mkitti-update-documenter-jl-gha
Update Github Actions for Documenter.jl
2 parents 06b779c + ac264b6 commit ed3ccf8

File tree

2 files changed

+51
-5
lines changed

2 files changed

+51
-5
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Doc Preview Cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
# Ensure that only one "Doc Preview Cleanup" workflow is force pushing at a time
8+
concurrency:
9+
group: doc-preview-cleanup
10+
cancel-in-progress: false
11+
12+
jobs:
13+
doc-preview-cleanup:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
steps:
18+
- name: Checkout gh-pages branch
19+
uses: actions/checkout@v4
20+
with:
21+
ref: gh-pages
22+
- name: Delete preview and history + push changes
23+
run: |
24+
if [ -d "${preview_dir}" ]; then
25+
git config user.name "Documenter.jl"
26+
git config user.email "documenter@juliadocs.github.io"
27+
git rm -rf "${preview_dir}"
28+
git commit -m "delete preview"
29+
git branch gh-pages-new "$(echo "delete history" | git commit-tree "HEAD^{tree}")"
30+
git push --force origin gh-pages-new:gh-pages
31+
fi
32+
env:
33+
preview_dir: previews/PR${{ github.event.number }}

.github/workflows/Documentation.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,28 @@ on:
99

1010
jobs:
1111
build:
12+
# These permissions are needed to:
13+
# - Deploy the documentation: https://documenter.juliadocs.org/stable/man/hosting/#Permissions
14+
# - Delete old caches: https://github.com/julia-actions/cache#usage
15+
permissions:
16+
actions: write
17+
contents: write
18+
pull-requests: read
19+
statuses: write
1220
runs-on: ubuntu-latest
1321
steps:
1422
- uses: actions/checkout@v4
15-
- uses: julia-actions/setup-julia@latest
23+
- uses: julia-actions/setup-julia@v2
1624
with:
17-
version: '1.6'
25+
version: '1'
26+
- uses: julia-actions/cache@v2
1827
- name: Install dependencies
19-
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
28+
shell: julia --color=yes --project=docs {0}
29+
run: |
30+
using Pkg
31+
Pkg.develop(PackageSpec(path=pwd()))
32+
Pkg.instantiate()
2033
- name: Build and deploy
34+
run: julia --color=yes --project=docs docs/make.jl
2135
env:
22-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # If authenticating with SSH deploy key
23-
run: julia --project=docs/ docs/make.jl
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)