Skip to content

Commit 0083bfc

Browse files
Use Turing Actions for JuliaGP docs and Navbar (#446)
1 parent 23dfd7a commit 0083bfc

File tree

2 files changed

+36
-47
lines changed

2 files changed

+36
-47
lines changed

.github/workflows/DocNav.yml

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,40 @@
1-
name: Add Navbar
1+
name: Rebuild docs with newest navbar
22

33
on:
4-
page_build: # Triggers the workflow on push events to gh-pages branch
5-
workflow_dispatch: # Allows manual triggering
4+
# 3:25 AM UTC every Sunday -- choose an uncommon time to avoid
5+
# periods of heavy GitHub Actions usage
66
schedule:
7-
- cron: '0 0 * * 0' # Runs every week on Sunday at midnight (UTC)
7+
- cron: '25 3 * * 0'
8+
# Whenever needed
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
813

914
jobs:
10-
add-navbar:
15+
update-navbar:
1116
runs-on: ubuntu-latest
12-
permissions:
13-
contents: write
17+
1418
steps:
15-
- name: Checkout gh-pages
19+
- name: Checkout gh-pages branch
1620
uses: actions/checkout@v4
1721
with:
1822
ref: gh-pages
19-
fetch-depth: 0
2023

21-
- name: Download insert_navbar.sh
22-
run: |
23-
curl -O https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/insert_navbar.sh
24-
chmod +x insert_navbar.sh
24+
- name: Insert navbar
25+
uses: TuringLang/actions/DocsNav@main
26+
with:
27+
doc-path: '.'
28+
navbar-url: https://raw.githubusercontent.com/JuliaGaussianProcesses/.github/refs/heads/main/DocumenterNavbar/JuliaGPNavbar.html
2529

26-
- name: Update Navbar
27-
env:
28-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
- name: Commit and push changes
2931
run: |
30-
git config user.name github-actions[bot]
31-
git config user.email github-actions[bot]@users.noreply.github.com
32-
33-
# Define the URL of the navbar to be used
34-
NAVBAR_URL="https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/JuliaGPNavbar.html"
35-
36-
# Update all HTML files in the current directory (gh-pages root)
37-
./insert_navbar.sh . $NAVBAR_URL
38-
39-
# Remove the insert_navbar.sh file
40-
rm insert_navbar.sh
41-
42-
# Check if there are any changes
4332
if [[ -n $(git status -s) ]]; then
44-
git add .
45-
git commit -m "Added navbar and removed insert_navbar.sh"
46-
git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages
33+
git config user.name github-actions[bot]
34+
git config user.email github-actions[bot]@users.noreply.github.com
35+
git add -A
36+
git commit -m "Update navbar (automated)"
37+
git push
4738
else
4839
echo "No changes to commit"
4940
fi

.github/workflows/docs.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,30 @@ name: Documentation
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
tags: '*'
88
pull_request:
9+
workflow_dispatch:
910

1011
concurrency:
1112
# Skip intermediate builds: always.
1213
# Cancel intermediate builds: only if it is a pull request build.
1314
group: ${{ github.workflow }}-${{ github.ref }}
1415
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
1516

17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
1621
jobs:
17-
build:
22+
docs:
1823
runs-on: ubuntu-latest
24+
1925
steps:
20-
- uses: actions/checkout@v2
21-
- uses: julia-actions/setup-julia@latest
22-
with:
23-
version: '1.10'
24-
- name: Install dependencies
25-
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
26-
env:
27-
JULIA_PKG_SERVER: ''
28-
- name: Build and deploy
26+
- name: Build and deploy Documenter.jl docs
2927
env:
3028
GKSwstype: nul # turn off GR's interactive plotting for notebooks
31-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
32-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key
33-
JULIA_DEBUG: Documenter # Print `@debug` statements (https://github.com/JuliaDocs/Documenter.jl/issues/955)
34-
run: julia --project=docs/ docs/make.jl
29+
uses: TuringLang/actions/DocsDocumenter@main
30+
with:
31+
julia-version: '1.10'
32+
navbar-url: https://raw.githubusercontent.com/JuliaGaussianProcesses/.github/refs/heads/main/DocumenterNavbar/JuliaGPNavbar.html

0 commit comments

Comments
 (0)