docs: only set base-href in CI built docs

This reverts commit c12e59ff7c
This commit is contained in:
Matt Sturgeon 2024-11-18 19:31:12 +00:00
parent cdbda982f0
commit 99b066ba6d
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
3 changed files with 32 additions and 10 deletions

View file

@ -26,6 +26,9 @@ jobs:
environment: environment:
name: github-pages name: github-pages
url: ${{ steps.deployment.outputs.page_url }} url: ${{ steps.deployment.outputs.page_url }}
repo: "${{ github.repository }}"
repoName: "${{ github.event.repository.name }}"
out: docs-build
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 40 timeout-minutes: 40
steps: steps:
@ -40,14 +43,33 @@ jobs:
name: nix-community name: nix-community
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- run: | - name: Build docs
run: |
set -ex set -ex
mkdir -p docs-build
nix build github:nix-community/nixvim#docs # 1: branch
cp -r result/share/doc/nixvim/* docs-build # 2: dest-dir (relative to /nixvim/)
nix build github:nix-community/nixvim/nixos-24.05#docs build() {
# TODO: use the new path when 24.11 hits flake="github:${repo}${1:+/$1}"
cp -r result/share/doc docs-build/stable baseHref="/${repoName}/${2:+$2/}"
destDir="${out}${baseHref}"
# Build docs for the given flake ref, overriding baseHref in the derivation args
nix build --impure --expr '(builtins.getFlake "'"$flake"'").outputs.packages.${builtins.currentSystem}.docs.override {
baseHref = "'"$baseHref"'";
}'
# Copy the result to the dest-dir
mkdir -p "$destDir"
cp -r result/share/doc/* "$destDir"
}
# Install main-branch docs at the top-level
build 'main' ''
# Install 24.05 docs under 'stable'
# TODO: consider having `<release>` instead of `stable`
build 'nixos-24.05' 'stable'
- name: Upload artifact - name: Upload artifact
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3

View file

@ -6,7 +6,7 @@
transformOptions, transformOptions,
search, search,
# The root directory of the site # The root directory of the site
baseHref ? "/nixvim/", baseHref ? "/",
}: }:
let let
inherit (evaledModules.config.meta) nixvimInfo; inherit (evaledModules.config.meta) nixvimInfo;
@ -305,7 +305,7 @@ pkgs.stdenv.mkDerivation (finalAttrs: {
}; };
buildPhase = '' buildPhase = ''
dest=$out/share/doc/nixvim dest=$out/share/doc
mkdir -p $dest mkdir -p $dest
# Copy (and flatten) src into the build directory # Copy (and flatten) src into the build directory

View file

@ -12,5 +12,5 @@ class UncachedHTTPHandler(http.server.SimpleHTTPRequestHandler):
with http.server.HTTPServer(("", PORT), UncachedHTTPHandler) as httpd: with http.server.HTTPServer(("", PORT), UncachedHTTPHandler) as httpd:
print(f"Serving documentation at http://localhost:{PORT}/nixvim") print(f"Serving documentation at http://localhost:{PORT}")
httpd.serve_forever() httpd.serve_forever()