diff --git a/.github/workflows/DocNav.yml b/.github/workflows/DocNav.yml index f5df0ba0a..b1b1a5da3 100644 --- a/.github/workflows/DocNav.yml +++ b/.github/workflows/DocNav.yml @@ -1,49 +1,40 @@ -name: Add Navbar +name: Rebuild docs with newest navbar on: - page_build: # Triggers the workflow on push events to gh-pages branch - workflow_dispatch: # Allows manual triggering + # 3:25 AM UTC every Sunday -- choose an uncommon time to avoid + # periods of heavy GitHub Actions usage schedule: - - cron: '0 0 * * 0' # Runs every week on Sunday at midnight (UTC) + - cron: '25 3 * * 0' + # Whenever needed + workflow_dispatch: + +permissions: + contents: write jobs: - add-navbar: + update-navbar: runs-on: ubuntu-latest - permissions: - contents: write + steps: - - name: Checkout gh-pages - uses: actions/checkout@v6 + - name: Checkout gh-pages branch + uses: actions/checkout@v4 with: ref: gh-pages - fetch-depth: 0 - - name: Download insert_navbar.sh - run: | - curl -O https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/insert_navbar.sh - chmod +x insert_navbar.sh + - name: Insert navbar + uses: TuringLang/actions/DocsNav@main + with: + doc-path: '.' + navbar-url: https://raw.githubusercontent.com/JuliaGaussianProcesses/.github/refs/heads/main/DocumenterNavbar/JuliaGPNavbar.html - - name: Update Navbar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Commit and push changes run: | - git config user.name github-actions[bot] - git config user.email github-actions[bot]@users.noreply.github.com - - # Define the URL of the navbar to be used - NAVBAR_URL="https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/JuliaGPNavbar.html" - - # Update all HTML files in the current directory (gh-pages root) - ./insert_navbar.sh . $NAVBAR_URL - - # Remove the insert_navbar.sh file - rm insert_navbar.sh - - # Check if there are any changes if [[ -n $(git status -s) ]]; then - git add . - git commit -m "Added navbar and removed insert_navbar.sh" - git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages + git config user.name github-actions[bot] + git config user.email github-actions[bot]@users.noreply.github.com + git add -A + git commit -m "Update navbar (automated)" + git push else echo "No changes to commit" fi diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index da09b4140..884dd68cf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,6 +6,7 @@ on: - master tags: '*' pull_request: + workflow_dispatch: concurrency: # Skip intermediate builds: always. @@ -13,20 +14,19 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +permissions: + contents: write + pull-requests: write + jobs: - build: + docs: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v6 - - uses: julia-actions/setup-julia@latest - with: - version: '1' - - name: Install dependencies - run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - - name: Build and deploy + - name: Build and deploy Documenter.jl docs env: GKSwstype: nul # turn off GR's interactive plotting for notebooks - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} # For authentication with SSH deploy key - JULIA_DEBUG: Documenter # Print `@debug` statements (https://github.com/JuliaDocs/Documenter.jl/issues/955) - run: julia --project=docs/ docs/make.jl + uses: TuringLang/actions/DocsDocumenter@main + with: + julia-version: '1' + navbar-url: https://raw.githubusercontent.com/JuliaGaussianProcesses/.github/refs/heads/main/DocumenterNavbar/JuliaGPNavbar.html diff --git a/docs/make.jl b/docs/make.jl index f0b2808ff..aceec36f7 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -44,9 +44,5 @@ makedocs(; doctestfilters=JuliaGPsDocs.DOCTEST_FILTERS, ) -deploydocs(; - repo="github.com/JuliaGaussianProcesses/KernelFunctions.jl.git", push_preview=true -) - # Remove JuliaGPsDocs (when running locally, we don't want to accidentally commit it) Pkg.rm("JuliaGPsDocs")