LuxDL / DocumenterVitepress.jl

Documentation with Documenter.jl and VitePress
https://luxdl.github.io/DocumenterVitepress.jl/
MIT License
64 stars 9 forks source link

Incorrect paths when deploying on github CI #63

Closed dominic-chang closed 4 months ago

dominic-chang commented 4 months ago

I'm trying to deploy my documentation to github pages with a github workflow. I've copied the make.jl file and documentation.yml from the DocumenterVitepress.jl repo, but using these files for deployment results in all of the websites files being stored in dev/. Github pages however seems to expect all the assets to be in the root directory, so connecting to the documentation page results in none of the assets being rendered.

Here is my make.jl file and my documenter.yml settings:

    sitename="Krang.jl",
    authors="Dominic <dchang3419@hotmail.com> and contributors",
    modules=[Krang],
    repo="https://github.com/dchang10/Krang.jl/blob/{commit}{path}#{line}",
    format=format,
    draft = false,
    source = "src",
    build = "build",
    pages=[
        "Home" => "index.md",
        "Getting Started" => "getting_started.md",
        "Examples" => MD_FILES,
        "Theory" => [
            "Raytracing" => [
                "kerr_geodesic_summary.md",
                "time_regularization.md",
            ],
            "Polarization" => [
                "newmann_penrose.md",
                "polarization.md",
            ]
        ],
        "api.md",
    ],
)

deploydocs(;
    repo="github.com/dchang10/Krang.jl",
    target = "build", # this is where Vitepress stores its output
    devbranch="main",
    push_preview=true,
)
name: Documentation

on:
  push:
    branches: [main]
    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/') }}

jobs:
  build:
    permissions:
      actions: write
      contents: read
      pages: write
      id-token: write
      statuses: write
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup Node # This is still useful because it caches the node_modules so we don't constantly re-install.  You don't technically need this, though.
        uses: actions/setup-node@v4
        with:
            node-version: 20
            cache: npm 
            cache-dependency-path: 'docs/package-lock.json' # this should be a package-lock.json file
      - run: cd docs/; rm package-lock.json; npm install; cd ..
      - name: Setup Julia
        uses: julia-actions/setup-julia@v1
        with:
          version: '1.10'
      - name: Pull Julia cache
        uses: julia-actions/cache@v1
      - name: Install docs dependencies
        run: julia --project=docs -e 'using Pkg; Pkg.develop([PackageSpec(path=pwd()), PackageSpec(path="https://github.com/LuxDL/DocumenterVitepress.jl.git")]); Pkg.instantiate()'
      - name: Install examples dependencies
        run: julia --project=examples -e 'using Pkg; Pkg.develop([PackageSpec(path=pwd()),]); Pkg.instantiate()'
      - name: Build and deploy
        uses: julia-actions/julia-docdeploy@v1
        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"
          DATADEPS_ALWAYS_ACCEPT: true
asinghvi17 commented 4 months ago

- ✘ ENV["GITHUB_REPOSITORY"]="dchang10/Krang.jl" occurs in repo="https://dchang10.github.io/Krang.jl" so you need to pass repo = "https://github.com/dchang10/Krang.jl", both here and in your DocumenterVitepress.MarkdownVitepress kwargs.

dominic-chang commented 4 months ago

Thanks. That worked