Skip to content

Commit

Permalink
Documentation and Turing Navigation CI improvement (#471)
Browse files Browse the repository at this point in the history
* Update Docs.yml

* Update Docs.yml

* Update DocsNav.yml

* No need of deploydocs() after using new Docs & DocsNav workflows

* Remove GKSwstype envvar

* Upper bound CairoMakie to 0.13.0

MakieOrg/Makie.jl#4759

---------

Co-authored-by: Penelope Yong <[email protected]>
  • Loading branch information
shravanngoswamii and penelopeysm authored Feb 9, 2025
1 parent fa4ab8d commit d92cfb1
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 53 deletions.
33 changes: 15 additions & 18 deletions .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
name: Docs
name: Documentation

on:
push:
branches:
- master
tags: '*'
pull_request:


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

permissions:
contents: write
pull-requests: read

jobs:
docs:
name: Documentation
runs-on: ubuntu-latest
permissions:
pull-requests: read # Required when using `push_preview=true`
statuses: write # Optional, used to report documentation build statuses

steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
run: julia --project=docs docs/make.jl
env:
GKSwstype: nul
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- name: Build and deploy Documenter.jl docs
uses: TuringLang/actions/DocsDocumenter@main
54 changes: 22 additions & 32 deletions .github/workflows/DocsNav.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,39 @@
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
- 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: '.'

- 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/TuringNavbar.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
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ MLJDecisionTreeInterface = "c6f25543-311c-4c74-83dc-3ea6d1015661"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"

[compat]
CairoMakie = "0.6, 0.7, 0.8, 0.9, 0.10, 0.11, 0.12, 0.13"
CairoMakie = "0.6 - 0.13.0"
CategoricalArrays = "0.8, 0.9, 0.10"
DataFrames = "0.22, 1"
Documenter = "0.26, 0.27, 1"
Expand Down
2 changes: 0 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ makedocs(
modules = [MCMCChains],
checkdocs = :exports,
)

deploydocs(repo = "github.com/TuringLang/MCMCChains.jl.git", push_preview=true)

0 comments on commit d92cfb1

Please sign in to comment.