From 509cbaf1d77032f6ea8e0f01c9829297a258bc35 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sat, 8 Feb 2025 18:25:21 +0000 Subject: [PATCH 1/3] Update GHA to use shared org actions --- .github/workflows/Docs.yml | 19 +++++------- .github/workflows/DocsNav.yml | 56 +++++++++++++++-------------------- 2 files changed, 31 insertions(+), 44 deletions(-) diff --git a/.github/workflows/Docs.yml b/.github/workflows/Docs.yml index 95ad5340e..36bc0407f 100644 --- a/.github/workflows/Docs.yml +++ b/.github/workflows/Docs.yml @@ -15,19 +15,14 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} +permissions: + contents: write + pull-requests: read + jobs: docs: runs-on: ubuntu-latest + 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 - env: - 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 + - name: Build and deploy Documenter.jl docs + uses: TuringLang/actions/DocsDocumenter@v3 diff --git a/.github/workflows/DocsNav.yml b/.github/workflows/DocsNav.yml index 14614d1fd..69fceb4c2 100644 --- a/.github/workflows/DocsNav.yml +++ b/.github/workflows/DocsNav.yml @@ -1,49 +1,41 @@ -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: Install Julia + uses: julia-actions/setup-julia@v2 - - name: Update Navbar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git config user.name github-actions[bot] - git config user.email github-actions[bot]@users.noreply.github.com + - name: Insert navbar + uses: TuringLang/actions/DocsNav@v3 + with: + doc-path: '.' + navbar-url: ${{ github.action_path }}/scripts/TuringNavbar.html - # 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 + - name: Commit and push changes + run: | 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 add -A + git commit -m "Update navbar (automated)" + git push else echo "No changes to commit" fi From 820575f43440e83d19c33279ed5be43b0f51698c Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sat, 8 Feb 2025 18:29:55 +0000 Subject: [PATCH 2/3] Remove deploydocs call --- docs/make.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 5f6b820ff..66cc690f0 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -25,5 +25,3 @@ makedocs(; checkdocs=:exports, doctest=false, ) - -deploydocs(; repo="github.com/TuringLang/DynamicPPL.jl.git", push_preview=true) From b6360cd1a1d7abd1b3a411bad98c7da110124c96 Mon Sep 17 00:00:00 2001 From: Penelope Yong Date: Sat, 8 Feb 2025 19:16:04 +0000 Subject: [PATCH 3/3] Fix workflows (?). --- .github/workflows/Docs.yml | 2 +- .github/workflows/DocsNav.yml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Docs.yml b/.github/workflows/Docs.yml index 36bc0407f..2d874e922 100644 --- a/.github/workflows/Docs.yml +++ b/.github/workflows/Docs.yml @@ -25,4 +25,4 @@ jobs: steps: - name: Build and deploy Documenter.jl docs - uses: TuringLang/actions/DocsDocumenter@v3 + uses: TuringLang/actions/DocsDocumenter@main diff --git a/.github/workflows/DocsNav.yml b/.github/workflows/DocsNav.yml index 69fceb4c2..f7bc2fd5c 100644 --- a/.github/workflows/DocsNav.yml +++ b/.github/workflows/DocsNav.yml @@ -25,10 +25,9 @@ jobs: uses: julia-actions/setup-julia@v2 - name: Insert navbar - uses: TuringLang/actions/DocsNav@v3 + uses: TuringLang/actions/DocsNav@main with: doc-path: '.' - navbar-url: ${{ github.action_path }}/scripts/TuringNavbar.html - name: Commit and push changes run: |