diff --git a/.github/workflows/DocsNav.yml b/.github/workflows/DocsNav.yml new file mode 100644 index 00000000..a8c5cee2 --- /dev/null +++ b/.github/workflows/DocsNav.yml @@ -0,0 +1,45 @@ +name: Add Navbar + +on: + workflow_run: + workflows: ["*"] # add workflow names that generates docs in this list like `workflows: ["Docs Workflow", "Previews Workflow]` + types: + - completed + workflow_dispatch: # Allows manual triggering + +jobs: + add-navbar: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + permissions: + contents: write + steps: + - name: Checkout gh-pages + 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: 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 + + # Update all HTML files in the current directory (gh-pages root) + ./insert_navbar.sh . + + # Check if there are any changes + if [[ -n $(git status -s) ]]; then + git add . + git commit -m "added navbar" + git push "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" gh-pages + else + echo "No changes to commit" + fi \ No newline at end of file diff --git a/docs/make.jl b/docs/make.jl index 5faf7e47..9395d2a0 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -12,9 +12,4 @@ makedocs(; checkdocs=:exports, ) -# Insert navbar in each html file -run( - `sh -c "curl -s https://raw.githubusercontent.com/TuringLang/turinglang.github.io/main/assets/scripts/insert_navbar.sh | bash -s docs/build"`, -) - deploydocs(; repo="github.com/TuringLang/AbstractMCMC.jl.git", push_preview=true)