diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index f5d8314..b9a0539 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -2,7 +2,7 @@ name: "Pages" on: push: - branches: + branches: - stable - trunk workflow_dispatch: @@ -27,6 +27,9 @@ jobs: with: cachixToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - run: nix build .#docs + if: github.ref == 'refs/heads/stable' + - run: nix build .#docs-unstable + if: github.ref != 'refs/heads/stable' - name: Deploy to Cloudflare Pages id: deployment uses: cloudflare/wrangler-action@v3 diff --git a/doc/.vitepress/config.ts b/doc/.vitepress/config.ts index a98f16a..614c51d 100644 --- a/doc/.vitepress/config.ts +++ b/doc/.vitepress/config.ts @@ -8,10 +8,12 @@ import { localIconLoader, } from "vitepress-plugin-group-icons"; +const MODE = (process.env.MODE ?? "unstable") as "unstable" | "stable"; + // https://vitepress.dev/reference/site-config export default withMermaid( defineConfig({ - title: "wire", + title: MODE === "stable" ? "wire" : "wire (unstable!)", description: "a tool to deploy nixos systems", themeConfig: { search: { @@ -31,8 +33,17 @@ export default withMermaid( { text: "Guides", link: "/guides/installation" }, { text: "Reference", link: "/reference/cli" }, { - text: pkg.version, + text: MODE === "stable" ? pkg.version : "Unstable", items: [ + MODE === "unstable" + ? { + text: `View ${pkg.version}`, + link: "https://wire.althaea.zone", + } + : { + text: "View Unstable", + link: "https://trunk.wire-docs.pages.dev", + }, { text: "Changelog", link: "https://github.com/mrshmllow/wire/blob/trunk/CHANGELOG.md", diff --git a/doc/README.md b/doc/README.md index df4e6cb..3658310 100644 --- a/doc/README.md +++ b/doc/README.md @@ -12,7 +12,7 @@ pnpm run dev ## Build ```sh -nix build .#docs +nix build .#docs-unstable # or diff --git a/doc/default.nix b/doc/default.nix index 5da345d..634b97a 100644 --- a/doc/default.nix +++ b/doc/default.nix @@ -6,8 +6,15 @@ ... }: { - packages.docs = pkgs.callPackage ./package.nix { - inherit (self'.packages) wire-small-dev wire-dignostics-md; + packages = { + docs = pkgs.callPackage ./package.nix { + mode = "stable"; + inherit (self'.packages) wire-small-dev wire-dignostics-md; + }; + + docs-unstable = pkgs.callPackage ./package.nix { + inherit (self'.packages) wire-small-dev wire-dignostics-md; + }; }; }; } diff --git a/doc/package.nix b/doc/package.nix index 33b645c..83b6a81 100644 --- a/doc/package.nix +++ b/doc/package.nix @@ -8,6 +8,7 @@ nodejs, pnpm, stdenv, + mode ? "unstable", ... }: let @@ -65,4 +66,5 @@ stdenv.mkDerivation (finalAttrs: { nix-instantiate --eval --strict ./snippets > /dev/null ''; DEBUG = "*"; + MODE = mode; })